How do I write a prepared statement with an update?

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-03-21T08:59:45Z Indexed on 2010/03/21 9:01 UTC
Read the original article Hit count: 370

Filed under:
|
|

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 doing wrong?

© Stack Overflow or respective owner

Related posts about php

Related posts about prepared-statement