How do I write a prepared statement with an update?
I am using mysqli prepared statments and I am trying to write a prepared statement with an UPDATE, but I think I am off somewhere.
Here's my code:
$upload_folder = 'Some String';
$sql = 'UPDATE orders (upload_location)
SET (?)
WHERE order_id = 160';
$stmt = $conn->stmt_init();
if($stmt->prepare($sql)){
$stmt->bind_param('s', $upload_folder);
$location_inserted = $stmt->execute();
}
What am I doin开发者_如何学编程g wrong?
SET foo = ?
You haven't specified which column to update.
the correct sql-syntax for update is:
UPDATE table SET column = ?
you are using SET keqword instead of VALUES as it's supposed by query format.
精彩评论