Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[PHP] [newbie] How to do "batch insert"?

From: ÀîÑå Ian Li <liyan82(at)gmail.com>
Date: Fri Jun 08 2007 - 04:44:10 EDT


Hi all.
In the scene I want to insert all elements of an array in to a table, how can I do to commit them as a whole? currently I do like this:

<?php
$result = pg_prepare($dbconn, "ins_acl", 'INSERT INTO acls(oid,uid,gid,mod) VALUES($1,$2,$3,$4)'); for($i=0;$i<count($p["acls"]);$i++){

        pg_execute($dbconn, "ins_lgs",$p["acls"][i]); }
?>

I wonder while doing so, will it commit in each LOOP or just ONCE?

Thanks and Regards,

Ian

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq Received on Fri Jun 8 04:46:09 2007

This archive was generated by hypermail 2.1.8 : Fri Jun 08 2007 - 04:50:02 EDT

Do you need help?X

Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library