我想用pdo更新php中的一行。。。但是做不到,&也不出错。。。
php://pdo函数中的my sql update函数,用于处理准备好的语句(用于所有查询)
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
}
}
我的更新pdo sql代码:
sql($DBH, "UPDATE tbl_causes SET title=?,para1=?,bullets=?,img=? WHERE id = ?", array($title, $para1, $bullets, $img, $id), "rows");
暂无答案!
目前还没有任何答案,快来回答吧!