I have this code right now and I only get the last two rows, but I need to get as many as there are in the database with the html. Thank you in advance
//We include the includes.php, which contains our db connection data.
include("includes.php");
//dbCon(); references the db connection data in includes.php - in other words we call a function.
dbCon();
$query = "SELECT * FROM product WHERE categoryid = 1;";
$result = mysqli_query($dbc,$query) or die('Error querying database.');
if (mysqli_num_rows($result) == NULL) {
mysqli_close($dbc);header("Location:index.php?l=f");exit();
}
while ($row = mysqli_fetch_assoc($result)){
$name = $row['name'];
$price = $row['price'];
}
echo "<input type='checkbox' name='name' value='name'>".$name."</br>";
echo "Price: "." "."<strong>".$price."</strong></br>";