db.php
时间:2021-07-01 10:21:17
帮助过:50人阅读
<?php
/**
*
*/
function insert($array, $table){
$fields = implode(‘,‘, array_key($array));
$values = "‘" . implode("‘,‘", $array) . "‘";
$sql = "INSERT INTO {$table}({$filds}) VALUES({$values})";
return $sql;
}
function update($array)
{
foreach($array as $fields => $value){
$sql .= $fields . ‘=\‘‘ . $value . ‘\‘,‘;
}
$sql = substr($sql, 0, -1);
$sql = "UPDATE ? SET " .$sql;
echo $sql;
}
db.php
标签:for php div int echo insert sub each update