Hi, im new to php and have just learned the basics of
reading / writing to a mysql database using a php web
front end... I have this code (below)
All it is doing is populating a text field (for my debugging purposes) with the number of records within those specified dates...
In any case my problem is with the if statement for the count(*) function.
It will simply not work, it will say it is not greater than zero, when infact it is, or, when i put quotations around the '0' the opposite occurs...
Ive been trying to figure this out for hours...
help would be soooooo much appreciated
<?php
mysql_connect("localhost", "root", "password");
$result = mysql_query("select count()
from hotel.bookings
Where RoomID = '1' and DateCheckin <= '06/01/2005' and DateCheckout >= '06/03/2005'") or
die (mysql_error());
while ($row = mysql_fetch_array($result))
{
echo "<input name='result' value=" . $row["count()"] . ">";
if ( "count(*)" > 0 ) {
echo "greater than zero";
} else {
echo "less than zero";
}
}
?>