Home  >  Q&A  >  body text

Running PHP project shows blank

My main problem is that the php projects that used to be run using xampp cannot run now. They can display html, and some php pages that do not need to be connected to the database can also be displayed. As long as they need to be connected to the database, it will not work. I have no idea why. , please big guys, please save the child!

The following is the code to connect to the database:

<?phperror_reporting(0); //Database link file $host='127.0.0.1';//Database server $user='root ';//Database user name $password='';//Database password $database='kaoshi';//Database name $conn=@mysqli_connect($localhost,$user,$password) or die('Database connection failed !');@mysql_select_db($database) or die('No database found!');

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);  }}?>

千落千落1343 days ago1134

reply all(1)I'll reply

  • 灭绝师太

    灭绝师太2021-01-21 09:26:09

    Download phpstudy, Chinese people are all using phper~

    reply
    0
  • Cancelreply