0

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

3
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by hellangel
0

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:

echo "<hr />".$sql."<hr />";
exit();

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.

0

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.