Blaine0002 Posted September 1, 2010 Share Posted September 1, 2010 Hi, i have a user update function in my code so I can easily change user fields int he database public function updateUser ($username, $value, $what) { $q = "UPDATE `users` SET ? = ? WHERE username = ?"; if ($stmt = $this->db_connection->prepare($q)) { $stmt->bind_param("sis", $what, $value, $username); $stmt->execute(); } } The database is connected successfully, but say i run a updateUser('blaine0002', 'blah', 'password'); nothing would get updated and no errors are thrown. Am i doing something wrong? Thank you! Link to comment https://forums.phpfreaks.com/topic/212255-mysqli-update-function-not-working/ Share on other sites More sharing options...
Alex Posted September 1, 2010 Share Posted September 1, 2010 Prepared statement parameters can't be column names. Link to comment https://forums.phpfreaks.com/topic/212255-mysqli-update-function-not-working/#findComment-1105984 Share on other sites More sharing options...
Blaine0002 Posted September 1, 2010 Author Share Posted September 1, 2010 Bummer. Thank you for the reply. Link to comment https://forums.phpfreaks.com/topic/212255-mysqli-update-function-not-working/#findComment-1105988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.