导致错误的一行是......
mysql_close($con);
以下是整个代码......
$con=mysqli_connect("localhost","root","pass","db_name");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM medicos");
while($row = mysqli_fetch_array($result)) {
echo '.....';
}
mysql_close($con);
答案 0 :(得分:10)
行mysql_close($con);
必须更改为mysqli_close($con);
您不能互换使用mysql
和mysqli
函数,例如:
mysqli_connect
需要使用mysqli_close
- 同样 -
mysql_connect
需要使用mysql_close