Hey I am currently working on this code to create a list of students depending on an entry on a HTML form. I am receiving the following error:
Warning: mysqli_query() expects parameter 1 to be mysqli, string given in ..... on line 15.
I have made a lot of changes and rearrangements but can't seem to get it to work. Any hints of help would be absolutely amazing!!
The code is:
<?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 />';
?>
Thank you.