嘿,我目前正在处理此代码,以根据 HTML 表单上的条目创建学生列表。我收到以下错误:
Warning: mysqli_query() expects parameter 1 to be mysqli, string given in ..... on line 15.
我做了很多改变和重新安排,但似乎无法让它发挥作用。任何帮助的提示都将是绝对惊人的!
代码是:
<?php
require_once 'connect.php';
mysql_select_db("db_ll20g11");
if ($_POST ['criterion'] == 'c'){
$status = 'current';
echo 'Current students list<br/>';
}
else{
$status ='left';
echo' Left Students list <br/>';
}
$listings = "SELECT * FROM student WHERE status ='".$status."'";
$results = mysqli_query($listings, $connect);
//mysqli_fetch_query not working
while ($row = mysqli_fetch_array($results))
{
echo 'Name:' .$row['name'] . " " .' Date of Birth:' .$row['dateOfBirth'] . " " . 'Gender:' .$row['gender'] . " " .'Email:' .$row['email']. " ";
}
echo '<br />';
?>
谢谢你。