AW: multiple table inserts at the same time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hallo rolf,

your idea is good, but its better you have a function that remove inserts,
if any inserts failed.
if you have mysql comiled under bsd or your mysql like immoDB your can take
this with "ROLLBACK"
function. if your mysql isn't comiled like this, you must rollback over a
own rollback
function.

mfg

andreas van loock

-----Ursprüngliche Nachricht-----
Von: rolf vreijdenberger [mailto:rolfvreijdenberger@hotmail.com]
Gesendet: Sonntag, 8. Dezember 2002 00:54
An: php-db@lists.php.net
Betreff:  multiple table inserts at the same time


hi there,

I have multiple tables in my mysql db.
Users register, and after submitting there are multiple tables that need
inserts.

What is the best way to do this? speedwise, efficiencywise, codewise?
(pseudo code)

A) $sql[]='insert1';
    $sql[]='insert2';
    $sql[]='insert3';
foreach($sql as $doMe){
mysql_query($doMe);//i left safety checks aside for clarity
}

B)$sql='insert1';
mysql_query($sql);
    $sql='insert2';
mysql_query($sql);
    $sql='insert3';
mysql_query($sql);

I'd prefer the first method, as it makes for easier updating of the queries
in a centralized place.
but I am wondering what your methods are, and any advantages or
disadvantages known to you.

thanks a lot



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux