<?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; }