Panta Posted April 28, 2017 Share Posted April 28, 2017 Please i dont know why this is not working fine, $unsetmerge=$flash->query("UPDATE `user` SET merged='no' WHERE email IN ('$emailuser','$togethelp')"); it will SET '$emailuser' to no but will not do same for '$togethelp' . i dont know what am not doing right and when i print $togethelp it contains the proper data Link to comment Share on other sites More sharing options...
Gabrielphp Posted April 28, 2017 Share Posted April 28, 2017 (edited) First stop using this query as it is not protected. Use prepared statements in order to protect your data from possible attacks. CODE: try { $sql = "UPDATE `user` SET merged = `no` WHERE email IN (:emailuser, :togethelp)"; $unsetmerge = $flash->prepare($sql); $unsetmerge->bindParam(":emailuser", $emailuser); $unsetmerge->bindParam(":togethelp", $togethelp); $unsetmerge->execute(); } catch (PDOException $e) { echo "Error: " . $e->getMessage(); } Using the catch function you can catch the error is being throw by the sql if there is any. This should do your job. Edited April 28, 2017 by Gabrielphp Link to comment Share on other sites More sharing options...
Panta Posted April 28, 2017 Author Share Posted April 28, 2017 ok thanks bro Link to comment Share on other sites More sharing options...
Ingolme Posted April 28, 2017 Share Posted April 28, 2017 That is PDO, it won't work with your MySQLi connection. See an example for opening a PDO connection here: https://www.w3schools.com/php/php_mysql_connect.asp Link to comment Share on other sites More sharing options...
Panta Posted April 28, 2017 Author Share Posted April 28, 2017 55 minutes ago, Ingolme said: That is PDO, it won't work with your MySQLi connection. See an example for opening a PDO connection here: https://www.w3schools.com/php/php_mysql_connect.asp ok thanks . let me check it Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now