Help getting my code to work

Hi, I’m currently building a website to display a database from 000webhost, I can connect fine but it doesn’t return any of the values I wish it to. Could someone look at my below code to see what I’m doing wrong? I’m not great with PHP yet so it has me stumped. Thanks

<?php
    //Step 1
	$servername = "localhost";
	$username = "id760726_john";
	$password = "";
	$database = "id760726_devproject2017";

echo "Connected successfully";
	
    
	
	$result = mysqli_query($db, "SELECT * FROM patients");
	
	echo "<table border = 5>";
		echo "<tr>";
			echo "<th>ID</th>
			<th>Patient name</th>
			<th>Check in date</th>
			<th>Room number</th>
			<th>Bed number</th>
			<th>Notes</th>";
		echo "</tr>";
	
	
	while($row = mysqli_fetch_array($result)){
		echo "<tr>";
			echo "<td>" . $row['id'] . "</td>";
			echo "<td>" . $row['patient_name'] . "</td>";
			echo "<td>" . $row['check_in_date'] . "</td>";
			echo "<td>" . $row['room_number'] . "<td>";
			echo "<td>" . $row['bed_number'] . "</td>";
			echo "<td>" . $row['notes'] . "</td>";
		echo "</tr>";
	}
	echo "</table>";
    mysqli_close($db);
		
		
        
?>

what is the error that you have got ?

There is no mysqli_connect so your script never connects to database

Nothing from my database appears on the website

Hi, where should I put this line? I’m new to PHP and not very good, thank you for the response

try this tutorial