我正在尝试重新编码以与 PHP7 一起使用,但失败得很惨。有人能指出我正确的方向吗?
这是错误:
警告:mysqli_query() 至少需要 2 个参数,1 个在 /Applications/XAMPP/xamppfiles/htdocs/students/index.php 第 55 行给出
致命错误:未捕获的错误:调用 /Applications/XAMPP/xamppfiles/htdocs/students/index.php:57 中未定义的函数 mysql_fetch_array() 堆栈跟踪:在 /Applications/XAMPP/xamppfiles/htdocs/students 中抛出 #0 {main} /index.php 第 57 行
PHP代码:
<?php
include("db.php");
$result=mysqli_query("SELECT * FROM students");
while($test = mysql_fetch_array($result))
{
$id = $test['UID'];
echo "<tr align='center'>";
echo"<td><font color='black'>" .$test['UID']."</font></td>";
echo"<td><font color='black'>" .$test['FirstName']."</font></td>";
echo"<td><font color='black'>". $test['LastName']. "</font></td>";
echo"<td><font color='black'>". $test['Marks']. "</font></td>";
echo"<td><font color='black'>". $test['RollNumber']. "</font></td>";
echo"<td> <a href ='view.php?UID=$id'>Edit</a>";
echo"<td> <a href ='del.php?UID=$id'><center>Delete</center></a>";
echo "</tr>";
}
mysql_close($conn);
?>
我已经删除了其他不必要的代码,只显示了一个正在创建错误的代码。