Current location: Hot Scripts Forums » Programming Languages » PHP » supplied argument is not a valid MySQL result resource


supplied argument is not a valid MySQL result resource

Reply
  #1 (permalink)  
Old 11-30-07, 11:58 PM
umarrana umarrana is offline
Newbie Coder
 
Join Date: Dec 2006
Location: Pakistan
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
supplied argument is not a valid MySQL result resource

Hi dear
this is the a big problem always come in my code
why this is with me
my script was running fine but shutdown my computer and start again this error come

i try to do every thing i past the backup but nothing its still same what is this problem can anybody now about this

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\a\login.php on line 19

this is error come in main site

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\a\display.php on line 133

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\a\display.php on line 6

Here is my code
Line No 6
while ($row=mysql_fetch_array($result)) {

Line No 133

mysql_free_result($result);

Last edited by umarrana; 12-01-07 at 12:11 AM.
Reply With Quote
  #2 (permalink)  
Old 12-01-07, 02:25 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
The error happens actually before, when you run a mysql_query() statement.

Add a OR die(mysql_error());, at the end of mysql_query(), to get the exact error from MySQL. It's impossible to help without seeing the error, or at least the query that caused the error.
Reply With Quote
  #3 (permalink)  
Old 12-01-07, 04:48 AM
Anoop's Avatar
Anoop Anoop is offline
Newbie Coder
 
Join Date: Dec 2007
Location: chennai
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Ckeck first the array is empty or not

in your code
check first if(isset($result ))
Reply With Quote
  #4 (permalink)  
Old 12-01-07, 06:47 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by umarrana View Post
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\a\login.php on line 19
In plain English this usually means you aren't getting any results back from your query. In this case I'd guess it's because you aren't getting a valid connection to the database but it's impossible to say based on the error message alone.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #5 (permalink)  
Old 12-01-07, 10:24 AM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Anoop, a mysql_query() function call that fails will return a FALSE value. A query that executed with no errors, even if it is an empty result set with zero rows, will return a result resource. An isset() test of either of these possible values returned by a mysql_query() will always be true.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
  #6 (permalink)  
Old 12-05-07, 01:34 AM
Anoop's Avatar
Anoop Anoop is offline
Newbie Coder
 
Join Date: Dec 2007
Location: chennai
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Dispaly full code

please send the full code ...
that is $result="" ?


while ($row=mysql_fetch_array($result)) {
__________________
Reply With Quote
Reply

Bookmarks


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result cpmross PHP 6 07-13-07 05:58 PM
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource Nikker PHP 9 07-12-06 03:05 AM
mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource Dion PHP 2 04-03-05 03:48 AM
mysql_fetch_array(): supplied argument is not a valid MySQL result resource... Dion PHP 3 07-16-04 03:48 AM
Supplied argument is not a valid MySQL result resource help aequo PHP 2 06-15-04 08:13 AM


All times are GMT -5. The time now is 07:32 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.