473,226 Members | 1,607 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 software developers and data experts.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result

I am getting the following error messages in my search:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on line 113

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on line 127

My code is below. Any help would be much appreciated.

************************************************** ***************************************
Expand|Select|Wrap|Line Numbers
  1. <?
  2. //This is only displayed if they have submitted the form
  3. if ($searching =="yes")
  4. {
  5. echo "<h2>Results</h2><p>";
  6.  
  7. //If they did not enter a search term we give them an error
  8. if ($find == "")
  9. {
  10. echo "<p>You forgot to enter a search term";
  11. exit;
  12. }
  13.  
  14. // Otherwise we connect to our Database
  15. mysql_connect("host", "*****", "*****") or die(mysql_error());
  16. mysql_select_db("DBname") or die(mysql_error());
  17.  
  18. // We preform a bit of filtering
  19. $find = strtoupper($find);
  20. $find = strip_tags($find);
  21. $find = trim ($find);
  22.  
  23. //Now we search for our search term, in the field the user specified
  24. $data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'");
  25.  
  26. //And we display the results
  27. while($result = mysql_fetch_array( $data ))
  28. {
  29. echo $result['Play'];
  30. echo " ";
  31. echo $result['Volume'];
  32. echo "<br>";
  33. echo $result['Opened'];
  34. echo "<br>";
  35. echo $result['Performances'];
  36. echo "<br>";
  37. echo "<br>";
  38. }
  39.  
  40. //This counts the number or results - and if there wasn't any it gives them a little message explaining that
  41. $anymatches=mysql_num_rows($data);
  42. if ($anymatches == 0)
  43. {
  44. echo "Sorry, but we can not find an entry to match your query<br><br>";
  45. }
  46.  
  47. //And we remind them what they searched for
  48. echo "<b>Searched For:</b> " .$find;
  49. }
  50. ?>
Aug 12 '07 #1
1 2667
pbmods
5,821 Expert 4TB
Heya, lsmamadele. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

Try echoing mysql_error() right after you call mysql_query().
Aug 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Pratchaya | last post by:
Hi Everyone ============================================================== About PHP::: Error/Problem PHP Warning: mysql_fetch_array():...
2
by: 00webman | last post by:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/html/scripts/07/view_users.php on line 15 Can anyone spot my error?!? Thanks. <?php # Script 7.6 -...
3
by: petemaxi | last post by:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\tockholes\includes\menu.inc.php on line 9 <div class="left"> <div class="menu">...
1
by: myaashik | last post by:
Hello! All I have a Error message saying that: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/rocks/public_html/colorado3.php on line 32 I have...
4
by: Ryanlawrence1 | last post by:
Heya, I get these 2 errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 20 You have not entered all the...
11
by: Breana | last post by:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/breana/public_html/category.php on line 88 ------------------------------------------- It does this...
4
by: simon2x1 | last post by:
how can i fix these error and what does it mean Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\test_php\log\search\result.php on line 8 ...
2
by: poreko | last post by:
I am connecting to my database using Object oriented PHP. My query is returning results but at the end of my table,at the bottom of the page I keep having this error when I run my program: Warning:...
11
by: chemlight | last post by:
I'm having a problem. I'm sure I'm going to kick myself over the answer... I have a table that stores vendors and their languages. This table starts out blank. I am querying the table to see if a...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.