TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-25-2012, 06:25 PM   #1 (permalink)
The Visitor
Newcomer 
 
Join Date: Jul 2012
Posts: 1
Thanks: 0
twiggs462 is on a distinguished road
Default Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

A client of mine is having an issue with an admin area of their site that I never encountered before...

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

The code that is being referenced is:

Code:
// new sql to pull associated products for seleceted family

$restwoway = mysql_query("SELECT * FROM members order by name;");
$numrows=mysql_num_rows(restwoway);

if($numrows=0){
echo "Invalid entry";
}
else { ?>
Anyone see any errors here or... do you need me to provide additional details. I never seen this error before and not sure how to address it . Thank you for any ideas you might have.
twiggs462 is offline  
Reply With Quote
Old 07-29-2012, 03:49 PM   #2 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

it seems in this line:
PHP Code:
$numrows=mysql_num_rows(restwoway); 
you forgot the dollar sign for restwoway. But I think that is just a misstype. You could see if the $reswoway is an actual resource of the results (doing a var_dump or your preference) and not something else. Seems to me that the results of the query is the problem.
tony is offline  
Reply With Quote
Old 08-04-2012, 03:18 AM   #3 (permalink)
The Visitor
 
Hanzo's Avatar
 
Join Date: Aug 2012
Location: 127.0.0.1
Posts: 2
Thanks: 0
Hanzo is on a distinguished road
Default

You're also assigning $numrows a value of 0 in your conditional. Know that if you don't need the else statement, just omit it. :)

Try this:

PHP Code:
// new sql to pull associated products for seleceted family 

 
$restwoway mysql_query("SELECT * FROM members ORDER BY name"); 

$numrows=mysql_num_rows($restwoway);  

if(
$numrows===0){

 echo 
"Invalid entry"


Hanzo is offline  
Reply With Quote
Old 08-04-2012, 11:59 PM   #4 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

Quote:
Originally Posted by Hanzo View Post
You're also assigning $numrows a value of 0 in your conditional...[/php]
Good catch on that! Those tricky equal signs.
tony is offline  
Reply With Quote
Reply



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

Advanced Search
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql_num_rows(): supplied argument is not a valid MySQL result resource Calus Absolute Beginners 6 01-29-2013 11:33 AM
mysql_num_rows(): supplied argument is not a valid MySQL result resource rios2 Absolute Beginners 2 06-13-2012 06:12 AM
help on making my own crawler webtuto General 16 08-08-2009 08:55 AM
Warning: fread(): supplied argument is not a valid stream resource sarmenhb General 7 04-23-2008 08:48 AM
Securing your MySQL Queries with Sprintf Wildhoney General 26 03-18-2008 06:52 PM


All times are GMT. The time now is 06:30 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design