•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 374,461 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,765 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 48642 | Replies: 5
![]() |
•
•
Join Date: Jun 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
hi,
i write a code like this
$user_id = $hd_cookie['user_id'];
$user_password = $hd_cookie['auth'];
$sql = "SELECT * FROM hd_users WHERE user_id='$user_id' AND user_password='$user_password'";
$r_user = mysql_query($sql);
$num=mysql_num_rows($r_user); //line 24
it shows Warning
Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\helpdeskfinal\includes\auth.php on line 24
when i print the sql statement and run the statement in MySql Window it gives the result.but from here it didn't give the result why?
i am using PHPTRIAD 2.1.1 version is this version supports mysql_num_rows????
please solve my problem
Thanks
Srinivas
i write a code like this
$user_id = $hd_cookie['user_id'];
$user_password = $hd_cookie['auth'];
$sql = "SELECT * FROM hd_users WHERE user_id='$user_id' AND user_password='$user_password'";
$r_user = mysql_query($sql);
$num=mysql_num_rows($r_user); //line 24
it shows Warning
Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\helpdeskfinal\includes\auth.php on line 24
when i print the sql statement and run the statement in MySql Window it gives the result.but from here it didn't give the result why?
i am using PHPTRIAD 2.1.1 version is this version supports mysql_num_rows????
please solve my problem
Thanks
Srinivas
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation:
Rep Power: 4
Solved Threads: 4
Debugging tip: You mention that you run the statement in MySql window, and it works, but did you actually copy & paste the statement as generated by your code? Right after you build the $sql variable, output it like so:
[php]
echo $sql;
exit();
[/php]
Then copy & paste that output in your MySql query windows and see if it works. You may find your problem.
[php]
echo $sql;
exit();
[/php]
Then copy & paste that output in your MySql query windows and see if it works. You may find your problem.
•
•
Join Date: Aug 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
I had exactly the same problem and I knew for certain I did spell the cellnames and tablename right.
I've found the solution. Simply put all the cellnames and tablename between ``. That's all!
[php]
$sql = "SELECT * FROM `hd_users` WHERE `user_id`='$user_id' AND `user_password`='$user_password'";
[/php]
If this doesn't work, first get the user_id and user_password out of the ``, only hd_users. If that doesn't work either, I don't it, for me it worked
grtz, Jero
I've found the solution. Simply put all the cellnames and tablename between ``. That's all!
[php]
$sql = "SELECT * FROM `hd_users` WHERE `user_id`='$user_id' AND `user_password`='$user_password'";
[/php]
If this doesn't work, first get the user_id and user_password out of the ``, only hd_users. If that doesn't work either, I don't it, for me it worked

grtz, Jero
•
•
Join Date: Aug 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Thanks, this thread helped me figure out a problem I was having too.
In my case, the problem was a missing semicolon at the end of the SQL statement. Was this also the problem for the original poster, I wonder?
In other words, this:
should have been this:
In my case, the problem was a missing semicolon at the end of the SQL statement. Was this also the problem for the original poster, I wonder?
In other words, this:
...snip... AND user_password='$user_password'";
should have been this:
...snip... AND user_password='$user_password';";
Last edited by gregarious : Aug 18th, 2007 at 4:20 am. Reason: clarify with code example
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
Similar Threads
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource (PHP)
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource (PHP)
- mysql_numrows(): supplied argument is not a valid MySQL result resource (PHP)
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource (PHP)
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in (PHP)
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource (PHP)
- mysql_num_rows(): supplied argument is not a valid MySQL result resource in /user/690 (PHP)
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
Other Threads in the MySQL Forum
- Previous Thread: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
- Next Thread: generating dynamic/runtime query


Linear Mode