Voting

: nine plus zero?
(Example: nine)

The Note You're Voting On

rorezende at hotmail dot com
21 years ago
Time is money, then I write a function similar to pg_insert in PHP (only output sql statement) :

function db_mount_insert($table,$array) {

$str = "insert into $table (";
while(list($name,$value) = each($array)) {
$str .= "$name,";
}
$str[strlen($str)-1] = ')';
$str .= " values (";
reset($array);
while(list($name,$value) = each($array)) {
if(is_string($value))
$str .= "'$value',";
else
$str .= "$value,";
}
$str[strlen($str)-1] = ')';
$str .= ";" ;

return $str;

}

<< Back to user notes page

To Top