📅  最后修改于: 2022-03-11 14:58:28.028000             🧑  作者: Mango
/* function to build SQL UPDATE string */
function build_sql_update($table, $data, $where)
{
$cols = array();
foreach($data as $key=>$val) {
$cols[] = "$key = '$val'";
}
$sql = "UPDATE $table SET " . implode(', ', $cols) . " WHERE $where";
return($sql);
}