I want to display a few records from my table, but there seems to be a problem with the mysqli part, these are the erros that keeps popping up;
Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in
D:\xampp\htdocs\Project\add_employees.php on line
78
Warning: mysqli_query() expects parameter 1 to be mysqli, string given in
D:\xampp\htdocs\Project\add_employees.php on line
79
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in
D:\xampp\htdocs\Project\add_employees.php on line
90
ID Name Phone Number Date Employed Date Unemployed
Can someone explain what the errors mean, and what I'm doing wrong ?
<?PHP
$conn = new mysqli("localhost","root","");
mysqli_select_db("kz_komputer",$conn);
$data = mysqli_query("SELECT * FROM employees",$conn);
echo "<table>
<tr>
<th> ID</th>
<th> Name</th>
<th> Phone Number</th>
<th> Date Employed</th>
<th> Date Unemployed</th>
</tr>";
while($record = mysqli_fetch_array($data)){
echo "<tr>";
echo "<td>" . $record['id'] . "</td>";
echo "<td>" . $recod['name'] . "</td>";
echo "<td>" . $record['phone_number'] . "</td>";
echo "<td>" . $record['date_employed'] . "</td>";
echo "<td>" . $record['date_unemployed'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($conn);
?>
What I have tried:
$conn = new mysql("localhost","root","","kz_komputer");
$sql = "SELECT * FROM employees";
$data = mysql_query($sql,$conn);