multiple table inserts at the same time

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

 



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


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

  Powered by Linux