This query is not updating the row in the database.
$link = mysqli_connect("localhost", "username", "password", "database");
mysqli_query("UPDATE `LOGIN` SET `HASH`='$hash' WHERE `USER`='$user'");
It simply does not update the hash in the row. I have checked the query in PMA and it seems to be running correctly. I have echo'ed out my $hash and $user variables on the screen to ensure they are valid, and they were. The mysqli_connect credentials are also correct... any input?
I have also tacked this onto mysqli_query and it just printed out "Error desc:" as I believe my server has errors off.
or die("Error desc: ".mysqli_error($link));
Thank you for any help!
EDIT: The table has around 3 records, so there's duplication is not issue here. Also, before anyone mentions it, I will be added a primary key to the table for each user and I will switch the mysqli to OO style once I figure out what's going on.
alfasin wrote in the comments to use bind_param (http://www.php.net/manual/en/mysqli-stmt.bind-param.php)
It worked great. It is good for both OO and procedural.
0 comments:
Post a Comment