I am these 2 errors come up in my database and I cant figure out the problem with my code....can someone help please? here is the code.
<body>
<?php
include("../misc.inc");
mysql_connect($host,$user,$pass);
mysql_select_db($database);
if($HTTP_GET_VARS['id'])
{
$query = "SELECT * FROM guestlist WHERE eventID = '".$HTTP_GET_VARS['id']."'";
$result = mysql_query($query);
$nrows = mysql_num_rows($result);
if($nrows > 0){
$i = 0;
$myGuests = array();
while($row = mysql_fetch_array($result))
{
extract($row);
$totalGuests += $guests;
$myGuests[$i] = "<tr><td>".($i+1)."</td><td>$guestName</td><td>$guests</td><td>$email</td></tr>";
$i++;
}
echo "<p>$nrows on guestlist, ".($nrows+$totalGuests)." expected for event.</p>";
echo "<table width =\"600\" border=\"1\">";
echo "<tr><th> </th><th>Name</th><th width=\"50\">Guests</th><th>Email</th></tr>";
for($i=0;$i<sizeof($myGuests);$i++)
{
echo $myGuests[$i];
}
echo "</table>";
}
else
{
echo "<p>No guests.</p>";
}
}
else
{
$currentDate = date("Y-m-d",time());
$query = "SELECT * FROM events_entries WHERE eventDate >= '$currentDate' ORDER by eventDate";
$result = mysql_query($query);
$nrows = mysql_num_rows($result);
while($row = mysql_fetch_array($result))
{
extract($row);
echo "<p>-<a href=\"getguests.php?id=$id\">$eventDate: $eventName @ $eventLocation</a></p>";
}
}
?>
<p>-<a href="index.php?<?php echo session_id(); ?>">Back To Main</a><br />
-<a href="logout.php?<?php echo session_id(); ?>">Logout</a></p>
</body>
I am getting these 2 error messages:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Please advise....thanks a lot guys!!