A
Anonymous
Guest
Hi i keep on getting the following error message and i don't know what to do I have tried all over the internet with no luck.
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/boss05/public_html/commitee/view2.php on line 8
my code is:
I would apprechiate any help on why when i change my query to include ORDER BY or WHERE it gives me the error message.
Thanks!
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/boss05/public_html/commitee/view2.php on line 8
my code is:
Code:
<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM members'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center><font face=Arial, Helvetica, sans-serif size=5>Members Database</center></b><br><br>";
?>
<FORM NAME="nav"><DIV>
<SELECT NAME="SelectURL" onChange=
"document.location.href=
document.nav.SelectURL.options[document.nav.SelectURL.selectedIndex].value">
<OPTION VALUE="0"
SELECTED>Please select an item:
<OPTION VALUE="view2.php">
First Name
<OPTION VALUE="view3.php">
Second Name
<OPTION VALUE="view4.php">
Forum Name
<OPTION VALUE="view5.php">
Membership Expirey
</SELECT><DIV>
</FORM>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif" size="2">Membership<br>Number</font></th>
<th><font face="Arial, Helvetica, sans-serif" size="2">Name</font></th>
<th><font face="Arial, Helvetica, sans-serif" size="2">Phone</font></th>
<th><font face="Arial, Helvetica, sans-serif" size="2">Mobile</font></th>
<th><font face="Arial, Helvetica, sans-serif" size="2">Email</font></th>
<th><font face="Arial, Helvetica, sans-serif" size="2">Forum Name</font></th>
<th><font face="Arial, Helvetica, sans-serif" size="2">Insurance Provider<br>BKSA/BBC</font></th>
<th><font face="Arial, Helvetica, sans-serif" size="2">Insurance Number</font></th>
<th><font face="Arial, Helvetica, sans-serif" size="2">Insurance Expire</font></th>
<th><font face="Arial, Helvetica, sans-serif" size="2">Membership<br> Expire</font></th>
</tr>
<?
$i=0;
while ($i < $num) {
$number=mysql_result($result,$i,"Membership Number");
$first=mysql_result($result,$i,"first name");
$last=mysql_result($result,$i,"second name");
$phone=mysql_result($result,$i,"phone number");
$mobile=mysql_result($result,$i,"mobile number");
$email=mysql_result($result,$i,"email address");
$forum=mysql_result($result,$i,"forum name");
$IProvider=mysql_result($result,$i,"insurance provider");
$INumber=mysql_result($result,$i,"insurance number");
$IExpire=mysql_result($result,$i,"insurance expire");
$expire=mysql_result($result,$i,"membership expire");
?>
<tr>
<td><font face="Arial, Helvetica, sans-serif"><center><? echo "$number"; ?></center></font></td>
<td><font face="Arial, Helvetica, sans-serif"><center><? echo "$first $last"; ?></center></font></td>
<td><font face="Arial, Helvetica, sans-serif"><center><? echo "$phone"; ?></center></font></td>
<td><font face="Arial, Helvetica, sans-serif"><center><? echo "$mobile"; ?></center></font></td>
<td><font face="Arial, Helvetica, sans-serif"><center><a href="mailto:<? echo "$email"; ?>"><? echo "$email"; ?></a></center></font></td>
<td><font face="Arial, Helvetica, sans-serif"><center><? echo "$forum"; ?></center></font></td>
<td><font face="Arial, Helvetica, sans-serif"><center><? echo "$IProvider"; ?></center></font></td>
<td><font face="Arial, Helvetica, sans-serif"><center><? echo "$INumber"; ?></center></font></td>
<td><font face="Arial, Helvetica, sans-serif"><center><? echo "$IExpire"; ?></center></font></td>
<td><font face="Arial, Helvetica, sans-serif"><center><? echo "$expire"; ?></center></font></td>
</tr>
<?
++$i;
}
echo "</table>";
?>
I would apprechiate any help on why when i change my query to include ORDER BY or WHERE it gives me the error message.
Thanks!