我主要的问题就是以前用xampp能运行的php项目现在运行不了,能显示html,部分不需要连接数据库的php页面也能显示,只要是需要连接数据库的都不行,完全不知道什么原因,求求大佬们救救孩子吧!
下面是连接数据库的代码:
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 <?php echo mysql_result($query,$fi,0);?> <?php } }}function getoption2($ntable,$nzd){ ?> 请选择 <?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 ><?php echo mysql_result($query,$fi,0);?> <?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 ; $i0) { 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); }}?>