运行PHP项目显示空白
问题描述
我主要的问题就是以前用xampp能运行的php项目现在运行不了,能显示html,部分不需要连接数据库的php页面也能显示,只要是需要连接数据库的都不行,完全不知道什么原因,求求大佬们救救孩子吧!
下面是连接数据库的代码:
<?phperror_reporting(0); //数据库链接文件$host='127.0.0.1';//数据库服务器$user='root';//数据库用户名$password='';//数据库密码$database='kaoshi';//数据库名$conn=@mysqli_connect($localhost,$user,$password) or die('数据库连接失败!');@mysql_select_db($database) or die('没有找到数据库!');
mysql_query("set names 'gb2312'");function getoption($ntable,$nzd){ $sql="select ".$nzd." from ".$ntable." order by id desc"; $query=mysql_query($sql); $rowscount=mysql_num_rows($query); if($rowscount>0) { for ($fi=0;$fi<$rowscount;$fi++) { ?> <option value="<?php echo mysql_result($query,$fi,0);?>"><?php echo mysql_result($query,$fi,0);?></option> <?php } }}function getoption2($ntable,$nzd){ ?> <option value="">请选择</option> <?php $sql="select ".$nzd." from ".$ntable." order by id desc"; $query=mysql_query($sql); $rowscount=mysql_num_rows($query); if($rowscount>0) { for ($fi=0;$fi<$rowscount;$fi++) { ?> <option value="<?php echo mysql_result($query,$fi,0);?>" <?php if($_GET[$nzd]==mysql_result($query,$fi,0)) { echo "selected"; } ?>><?php echo mysql_result($query,$fi,0);?></option> <?php } }}function getitem($ntable,$nzd,$tjzd,$ntj){ if($_GET[$tjzd]!="") { $sql="select ".$nzd." from ".$ntable." where ".$tjzd."='".$ntj."'"; $query=mysql_query($sql); $rowscount=mysql_num_rows($query); if($rowscount>0) { echo "value='".mysql_result($query,0,0)."'"; } }}function makefilename2(){ $i=1; $str = "0123456789"; // 输出字符集 $n = 4; // 输出串长度 $len = strlen($str)-1; for($i=0 ; $i<$n; $i++){ $s .= $str[rand(0,$len)]; } $timestamp=time(); return $timestamp.$s; } function readzd($ntable,$nzd,$tjzd,$ntj){ $sql="select ".$nzd." from ".$ntable." where ".$tjzd."='".$ntj."'"; $query=mysql_query($sql); $rowscount=mysql_num_rows($query); if($rowscount>0) { echo mysql_result($query,0,0); }}function readzd2($ntable,$nzd,$tjzd,$ntj){ $sql="select ".$nzd." from ".$ntable." where ".$tjzd."='".$ntj."'"; $query=mysql_query($sql); $rowscount=mysql_num_rows($query); if($rowscount>0) { return mysql_result($query,0,0); }}?>
问题解答
回答1:下载phpstudy吧, 国人phper都在用~
相关文章:
1. android - 优酷的安卓及苹果app还在使用flash技术吗?2. android - 使用百度sdk调用SDKInitializer.initialize(this)时报错?3. javascript - webpack-dev-server和webpack冲突吗4. javascript - 最近用echarts做统计图时遇到两个问题!!5. css3 - img垂直水平居中问题6. html5 - 用h5本地存储是否安全?7. javascript - 使用百度文本编辑器ueditor不显示样式问题8. 微信公众号在线生成二维码带参数怎么搞?9. javascript - react热加载的一段代码10. java中double类型转换为String类型?

网公网安备