Hi i am using the postgres with php and updating and inserting some data into db within the for loop. as i want to implement the transection (BEGIN, COMMIT, ROLLBACK) with it as these are sensetive data. So how can i do it. i am also attaching my code so that it can get a clear picture. How can i implement this with the below code. Please help me. with regards Sunit ###################################################### <?php $db= pg_connect("host=localhost dbname=abc user=xyz password=123"); $pkg_id1= $_POST["pkg_id"]; echo $cp_id= $_POST["cp_id"]; $id_total =count($pkg_id1); $search_string=@$_POST['search_string']; $i = 0; while ($i < $id_total) { $txt_pkg= "pgk_dis_".$pkg_id1[$i]; $txt_pkg= $_POST[$txt_pkg]; if($txt_pkg==''|| $txt_pkg=='0') { next; } else { $query_status = pg_exec($db,"select pkg_status from pkg_master where pkg_id='$pkg_id1[$i]'"); if(pg_result($query_status,0,"pkg_status")=='1') { next; } else { ####################### Updating the pkg_cp_discount table ##################### $query_count = pg_exec($db,"select cp_id, pkg_id from pkg_cp_discount where cp_id= '$cp_id'and pkg_id= '$pkg_id1[$i]'"); $total_count = pg_numrows($query_count); if($total_count =='0') { $query = pg_exec($db,"insert into pkg_cp_discount (pkg_price,cp_id, pkg_id) values('$txt_pkg', '$cp_id','$pkg_id1[$i]')"); } else { $query_update = pg_exec($db,"update pkg_cp_discount set pkg_price='$txt_pkg', cp_id='$cp_id' where pkg_id='$pkg_id1[$i]'"); } } } $i++; } ################################################## __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hfo971h/M=362131.6882499.7825260.1510227/D=groups/S=1705006764:TM/Y=YAHOO/EXP=1124958683/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org ">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life - brought to you by One Economy</a>.</font> --------------------------------------------------------------------~-> PHP Data object relational mapping generator - http://www.meta-language.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/