这是错误行125.实际上,我是MySQLi的新手,所以我无法理解如何将MySQL转换为MySQLi。
这是我的代码:
<?php
$query = mysql_query("select * from upload ORDER BY id DESC") or die(mysql_error());
while ($row = mysql_fetch_array($query)) {
$id = $row['id'];
$name = $row['name'];
$date=$row['date'];
}
答案 0 :(得分:0)
您需要将连接作为参数传递给mysqli_query()
:
$connection = mysqli_connect(
"your_host",
"your_user",
"your_password",
"your_db"
);
$result = mysqli_query(
$connection,
"select * from upload ORDER BY id DESC"
);
if (false === $result) {
die(mysqli_error($connection));
}
while ($row = mysqli_fetch_array($result)) {
$id = $row['id'];
$name = $row['name'];
$date = $row['date'];
}
供参考,见: