dozr13344
2018-07-02 05:43
浏览 666
已采纳

警告:mysqli_query()期望参数1为mysqli,null为何?

I am making a website for my high school annual project. The following error occurs in the php file :

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /host/home1/jbts/html/db/Plot-log.php on line 89

this is php source.

<?php
$link=mysqli_connect("localhost","xxxx","xxxxxxxxx","jbts");
if (!$link)
{ echo "MySQL error : "; echo mysqli_connect_error(); exit(); }
mysqli_set_charset($link,"utf8");
$sql = "select * from Plot-log";
$result = mysqli_query($link, $sql);
?>

and I used in html file like this.

<tr>
    <?  while($row=mysqli_query($con, $sql)){ ?>
        <tr> 
          <td> <?=$row[0]?></td> 
          <td> <?=$row[1]?></td>
          <td>  <?=$row[2]?></td>                                           
</tr>
    <?
    }
    ?>

i need your help... plz :)

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题