gpt4 book ai didi

php - MySql没有输出

转载 作者:太空宇宙 更新时间:2023-11-03 12:16:08 25 4
gpt4 key购买 nike

好的,我有这个代码

<?php
$email = htmlentities($_SESSION['user']['dato'], ENT_QUOTES, 'UTF-8');
$username = "mcnsaoia_onsafe";
$password = "XXX";
$hostname = "localhost";

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";

//select a database to work with
$selected = mysql_select_db("mcnsaoia_onsafe",$dbhandle)
or die("Could not select examples");

//execute the SQL query and return records
$result = mysql_query("SELECT * FROM users WHERE id= '$email'") or die(mysql_error());

//fetch tha data from the database
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['status'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "</tr>";
}
echo "</table>";
//close the connection
mysql_close($dbhandle);
?>

但是当我运行它时,它只是说连接到 MySQL 而它不输出任何东西?? 我不知道为什么会这样?!

最佳答案

while($row = mysqli_fetch_array($result))

mysql_fetch_array() 改变它

while($row = mysql_fetch_array($result))

关于php - MySql没有输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22069243/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com