473,320 Members | 1,884 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,320 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 2675
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.