$key=join(",",array_keys($a));//把$a数组键名,用join拼接成:id,Name,Age用于插入的字段名。
$vals="'".join("','",array_values($a))."'";//把$a数组键值,用join拼接成:'1','Bill','60'用于插入的字段的值。
组成了sql语句:
$sql = "INSERT 表名 (id,Name,Age) VALUES ('1','Bill','60')";
$vals="'".join("','",array_values($a))."'";//把$a数组键值,用join拼接成:'1','Bill','60'用于插入的字段的值。
组成了sql语句:
$sql = "INSERT 表名 (id,Name,Age) VALUES ('1','Bill','60')";
2016-11-09
$a=array("id"=>"1","Name"=>"Bill","Age"=>"60");
print_r(array_keys($a));
结果:Array ( [0] => id [1] => Name [2] => Age )
print_r(array_values($a));
结果:Array ( [0] => 1 [1] => Bill [2] => 60 )
print_r(array_keys($a));
结果:Array ( [0] => id [1] => Name [2] => Age )
print_r(array_values($a));
结果:Array ( [0] => 1 [1] => Bill [2] => 60 )
2016-11-09
出现这个 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261904 bytes) in D:\phpStudy\WWW\demo\Lecture0902\Lecture0902\core\cate.inc.php on line 41 提示 ,怎么破?
2016-11-08