mysql syntax error
Posted: Fri Nov 01, 2002 5:05 pm
Hi can anyone tell me why i am having an error in this code.
The error is mysql_fetch_array(): supplied argument is not a valid MySQL result resource.
Thanks
<html>
<body>
</body>
</html>
I have tried this also but it did not work.
The error is mysql_fetch_array(): supplied argument is not a valid MySQL result resource.
Thanks
<html>
<body>
Code: Select all
mysql_connect ("localhost","myusername","mypass");
mysql_select_db ("aboutDB");
if ($first_name == "")
{$first_name = '%';}
if ($last_name == "")
{$last_name = '%';}
$result = mysql_query ("SELECT * FROM abouttbl
WHERE first_name LIKE '$first_name%'
AND last_name LIKE '$last_name%'
");
if ($row = mysql_fetch_array($result)) {
do {
print $rowї"first_name"];
print (" ");
print $rowї"last_name"];
print ("<p>");
} while($row = mysql_fetch_array($result));
} else {print "Sorry, no records were found!";}</body>
</html>
I have tried this also but it did not work.
Code: Select all
if (mysql_numrows($result) > 0) {
do {
print $rowї"first_name"];
print (" ");
print $rowї"last_name"];
print ("<p>");
} while($row = mysql_fetch_array($result));
} else {print "Sorry, no records were found!";}