Thank you for the suggestions, Anthony.
There's another problem with UPDATE queries. As I understand it, all update and insert queries should return a boolean to indicate success or failure. For me, regardless of whether or not the update query changes anything, it's always returning "1". I worked around it by using mysql_affected_ rows() on the db resource, thanks to your suggestion of using mysql_num_rows( ) on the result...
User Profile
Collapse
-
Did some further testing, and the plot thickens.
I removed the one record from the database, leaving it complete empty, and the UPDATE query still returns a value of 1.
Performing a SELECT * FROM weblogins WHERE email='test@bla h.com' should also return -1, since there are no records in there, but instead returns "Resource id #6" as the result.
?????????
I say, ????Leave a comment:
-
wrong mySQL record updated with PHP
I've run into something that seems like a glitch, because the code and the test database are so simple that I can't fathom what could be wrong. I'm running a simple update query on a mySQL database, using PHP version 4.4.2 and mySQL 4.1.21-standard (my web host's, not my own):
[php]...
$resetkey = (...some randomized string...);
$query = "UPDATE weblogins SET veristring='".$ resetkey."' WHERE email='".$_POST['email']."'";
No activity results to display
Show More
Leave a comment: