Re: Strange problem with mySQL
| From: | Daniel Crespo | Date: | Fri, 26 Mar 2004 04:39:42 +0000 |
| Subject: | Re: Strange problem with mySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33651@lists.php.net to get a copy of this message | ||
Strange problem with mySQLTry to put backslashes before each single quote:
$query="UPDATE users set pw=\'$hash\' WHERE id=\'$user\'";
Remember to put them whenever you need to introduce special characters.
Daniel
"Craig Brown" <Craig.Brown@fmr.com> escribió en el mensaje news:B1BFCBF4E2B90843B8B84FA2A920F726029790DD@MSGMROCLA2WIN.DMN1.FMR.COM....
I am trying to update a database that I use
to store user names and the hashed values of passwords. The database name is Login, the table is
"users".
I have the following commands in my php file.
@ $db=mysql_pconnect('localhost','apache','password');
mysql_select_db('Login');
$query="UPDATE users set pw='$hash' WHERE id='$user'";
$results = mysql_query($query);
The result is always false. If I enter the value of $query into a console (such as mysqlcc). The
command works fine. Any ideas?
Thanks!
Craig