Same file new errors

2 views
Skip to first unread message

Mac

unread,
Apr 3, 2009, 4:39:42 PM4/3/09
to Tulsa PHP User's Group
Here is the error printed on the webpage. At least the webpage is
loading!!

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in C:\xampp\htdocs\sa\Search.php on line 107

Warning: mysql_free_result(): supplied argument is not a valid MySQL
result resource in C:\xampp\htdocs\sa\Search.php on line 143


I'm pretty sure this should work...it works on other pages.

thanks in advance!

Mac

JJ

unread,
Apr 3, 2009, 4:46:53 PM4/3/09
to Tulsa PHP User's Group
Notate out the line that reads:
$user = @mysql_fetch_array($result, MYSQL_ASSOC);

Switch line the following:
while ($row = mysql_fetch_array($user, MYSQL_ASSOC)) {

to read:
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {


You were already setting $user to the return MySQL array. Later, in
your while loop, you were trying to use $user as your query result.
Make sense?

JJ

unread,
Apr 3, 2009, 5:05:00 PM4/3/09
to Tulsa PHP User's Group
Actually, remove:
while ($row = mysql_fetch_array($user, MYSQL_ASSOC)) {

And it's closing curly brace.

You are already setting the $name, $volume, etc. before the loop using
the query's result set in the $user array. There's no need to run the
while loop to output the results.

Also, if you are testing to see if the $_POST['B1'] is not set, you
can remove the =TRUE. if (!$_POST['B1']) tests the same case.
Reply all
Reply to author
Forward
0 new messages