I am new to PHP and I am working on my on site now. I am trying to query the database and my code is not working. Please help!!! I have included my code if anyone can see a problem with my code I will try all things.
Code: Select all
<?php
$link = mysql_connect("mysql", "USERNAME", "PASSWORD");
mysql_select_db("asianbeachhouse booking");
if (!$link)
{
die('Could not connect: ' . mysql_error());
}
else
{
$Query = mysql_query("SELECT Count( reservation.RoomID ) AS CountOfRoomID,
reservation.RoomID
FROM reservation
WHERE ((((reservation.RDate) >= '$checkindate')
AND ((reservation.RDate) <= '$checkoutdate'))
AND ((reservation.Availability) = 'Vacant'))
GROUP BY reservation.RoomID;
$RAvail = mysqli_query($link,$Query);
$NumResAvail = mysqli_num_rows($RAvail)");
echo "<b>$NumResAvail Rooms Available</b>";
?>
<table border="1">
<tr>
<th>Count of RoomID</th>
<th>RoomID</th>
</tr>
<?php
while ($Row = mysqli_fetch_assoc($RAvail))
{
echo '<tr>';
echo '<td>' . $Row['CountOfRoomID'] . '</td>';
echo '<td>' . $Row['RoomID'] . '</td>';
echo '</tr>';
}
?>
</table>
<?php
mysqli_free_result($RAvail);
mysql_close($link);
}
?>pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: