<?php
/* declar some relevant variables */
$Host = "localhost"; //location of mySQL on server
$User = "michael"; //my username
$Pass = "koolaide"; //my password
$Name = "phpaccess"; //name of the database to be used
$Table = "info"; //name of the table within the database
mysql_connect ($Host, $User, $Pass, $Name, $Table) or die ("unable to connect to database");
mysql_select_db("$Name") or die ("unable to select DB");
$sqlquery = "SELECT * FROM $table WHERE opinion = 'is greate'";
$result = mysql_query($sqlquery);
$number = mysql_num_rows($result); //LINE NUMBER 23
$i = 0;
if ($number < 1)
{
echo "<center><p>There were no results for your search</p></center>";
}
else
{
while ($number > $i)
{
$thename = mysql_result ($result, $i, "name");
$theemail = mysql_result ($result, $i, "email");
echo "<p><b>Name:</b></p> $thename<br /><b>E-Mail:</b>$theemail</p>";
$i++;
}
}
?>
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\www\databaseconnect.php on line 23
i get that error, ive commented line number twentythree. this is just a database tutorial that im working on and i hope that maybe someone can tell me whats goin on.
o and dont worry about the username password stuff, this server will never go online, this is all practice stuff.
(line twenty three is in reference to the entire php file, this is only part of it, i left out the <html> tags part)