Please support our MySQL advertiser: Programming Forums
Views: 1715 | Replies: 2
![]() |
•
•
Join Date: Jul 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 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
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
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 345
Reputation:
Rep Power: 4
Solved Threads: 4
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.
"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.
•
•
Join Date: Sep 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 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 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?
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode