PHP PDO Related: Update SQL Statement not Updating the content of Database
Posted
by Rachel
on Stack Overflow
See other posts from Stack Overflow
or by Rachel
Published on 2010-03-05T17:49:58Z
Indexed on
2010/04/01
0:13 UTC
Read the original article
Hit count: 780
I am trying to implement update statement using prepared statement in php script but it appears that it is not update record in the database and am not sure why and so would appreciate if you can share some insights.
Code
$query = "UPDATE DatTable SET DF_PARTY_ID = :party_id,
DF_PARTY_CODE = :party_code,
DF_CONNECTION_ID = :connection_id WHERE DF_PARTY_ID = ':party_id'";
$stmt = $this->connection->prepare($query);
$stmt->bindValue(':party_id', $data[0], PDO::PARAM_INT);
$stmt->bindValue(':party_code', $data[1], PDO::PARAM_INT);
$stmt->bindValue(':connection_id', $data[2], PDO::PARAM_INT);
$stmt->execute();
Inspiring Solution leading to this approach. Any Suggestions ?
© Stack Overflow or respective owner