473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Invalid mysql result resource error

Expand|Select|Wrap|Line Numbers
  1. $email = sterile($_POST['email']);
  2. $zip = sterile($_POST['zip']);
  3.  
  4. $sql = mysql_query("SELECT * FROM users WHERE email='$email'");
  5. if(is_bool($sql)){
  6.     die("BOOL");
  7. }
  8. while($row = mysql_fetch_assoc($sql)){
  9. // reset password, etc
  10. }
  11.  
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /public_html/reset-password.php on line 8


I get this error from time to time, and still don't quite understand it. Typically, I spend around half an hour changing my query string until I have it back to how it was originally, then it magically starts working.

From reading up on it, I've gathered that this error generally occurs when the query returns a boolean result, or no result at all. (Hence the is_bool test code).

The curious part about this is.. despite the error, it still successfully queries the database, generates a random password, updates it in the database, and sends an email to the stored address.

Any thoughts??

Thanks!
Nov 27 '10 #1
1 1142
Dormilich
8,658 Expert Mod 8TB
The curious part about this is.. despite the error, it still successfully queries the database, generates a random password, updates it in the database, and sends an email to the stored address.
it looks like you’re using several mysql resources in one script. it may be that on some point you use the wrong resource (e.g. from INSERT/UPDATE) for mysql_fetch_assoc().
Nov 28 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Burton Figg | last post by:
Before I get in trouble, I have searched extensively for this one, in the PHP Docs, online etc. I have a simple page: <?php $un="jim"; $pw="jim"; $db="localhost";
9
by: Petr Vileta | last post by:
Hi, I'm new here and excuse me if this question was be here earlier. I have a simple code <html><body> <?php <?php $link = mysql_connect("localhost", "user", "password") or die("Grr: " ....
2
by: studentfromhell | last post by:
These mesages appeared... what should I do? script is below the error messages... Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in...
5
by: Mubs | last post by:
Hi, I 'am trying to connect my sql database with my webpage for users log in. i have got this script so far but i keep getting the following error message which i cannot figure out.. could any1...
4
by: fisherd | last post by:
When i run this code, i keep getting this message; Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\checklogin.php on line 26 i use this code to...
3
by: BOMEz | last post by:
Hi everyone, I have a form which updates some info in a DB. Currently the user does a search, which will load up results, which the user can change, and then submit those changes back into the DB....
1
by: byteit101 | last post by:
I was working with OOP, and was testing a sql result class, but it gives me the following error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource. I think it has...
1
mideastgirl
by: mideastgirl | last post by:
What does this error mean? Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/m/i/d/mideasthonors/html/student_session_proposal_success.php on...
2
by: macdalor | last post by:
Hi! I'm completely new to all dev and trying to put a website together using MySQLI and PHP; was running fine until I try to gather the DB content with the following script: <?...
9
by: Cxsey | last post by:
I get the following error code using this code: "Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource" It's on line 55 in this php script: <?php /** *...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.