Jump to content

MySQLI update function not working


Blaine0002

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.