I want to update a row in PHP by using PDO... but couldn't do that, & not giving an error too...
my SQL update function in php: // PDO Function To Handle Prepared Statements (FOR ALL QUERY)
function sql($DBH, $query, $params, $return) {
try {
// Prepare statement
$STH = $DBH->prepare($query);
// Execute statement
$STH->execute($params);
// Decide whether to return the rows themselves, or just count the rows
if ($return == "rows") {
return $STH->fetchAll();
}
elseif ($return == "count") {
return $STH->rowCount();
}
}
catch(PDOException $e) {
file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); # Errors Log File
}
}
my PDO SQL code for the update:
sql($DBH, "UPDATE tbl_causes SET title=?,para1=?,bullets=?,img=? WHERE id = ?", array($title, $para1, $bullets, $img, $id), "rows");