在SET操作中使用mysqli_stmt_bind_param

时间:2017-06-28 14:29:39

标签: php mysql mysqli

每当我尝试使用mysqli_stmt_bind_param在SET操作中将变量用作列名时,它似乎都失败了。我做错了什么还是我误解了什么?

$connection = mysqli_connect('localhost', 'username', '******', 'db');
$query = "UPDATE stock SET ? = '4' WHERE storeID = 1";

$stmt = mysqli_prepare($connection, $query);

mysqli_stmt_bind_param($stmt, "s", $shirtSize);
$shirtSize = "whiteSmall";

mysqli_stmt_execute($stmt);

mysqli_stmt_close($stmt);

mysqli_close($connection);

0 个答案:

没有答案