RSS Forums RSS
Please support our MySQL advertiser: Programming Forums
Views: 1715 | Replies: 2
Reply
Join Date: Jul 2005
Posts: 1
Reputation: silverfox is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
silverfox silverfox is offline Offline
Newbie Poster

Error message

  #1  
Jul 17th, 2005
Hello

New here, so don't know if doing this right, I am getting an error message that goes like this:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/target/geo/index.php on line 48
(here is the line in question)
$count_result = mysql_num_rows($result);


Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/target/geo/index.php on line 53
(here is the line in question)
$thirty_count_result = mysql_num_rows($thirty_result);

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/target/geo/index.php on line 74

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/target/geo/index.php on line 74

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/target/geo/index.php on line 74
(here is the line in question)
$country_count_r = mysql_fetch_array($country_count_result);


any idea's, or do you need more info?

silverfox
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 345
Reputation: Troy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

supplied argument is not a valid MySQL resource

  #2  
Jul 18th, 2005
ATTENTION ALL NEWBIES!

"supplied argument is not a valid MySQL resource" is almost always the result of an invalid SQL statement being passed to the database. When you are using a scripting language to dynamically build a SQL statement, it is VERY easy to introduce problems into your SQL string.

The good news is that this problem is very easy to troubleshoot. Find the line in your code where you execute the SQL statement. (mysql_query() for example). Just above that line add code similar to this:[php]echo "<hr />".$sql."<hr />";
exit();[/php]Replace $sql with your variable name. This will display the SQL statement in the browser. Now examine that SQL statement. Do you see any problems? Yes? Fix them. No? Then Copy & Paste that statement into a Query window in phpMyAdmin or in whatever admin tool you use. Run the statement and see what errors you get. Usually, the database will do a pretty good job of telling you what is wrong with your statement.

Once you discover the problem, modify your PHP (or other script) to remedy the issue.
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote  
Join Date: Sep 2005
Posts: 1
Reputation: hellangel is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hellangel hellangel is offline Offline
Newbie Poster

Re: Error message

  #3  
Sep 18th, 2005
hi Troy,

This is my situation: the script normally worked, but after about 10 days, I saw Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxxxx/public_html/function.inc.php on line 28

The page don't show half page, all database is empty, I think (because I don't see any records).

I tried to write your method, but after that I saw only two lines in my page. What is wrong?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:42 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC