Re: Multiple inserts as a single string?

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

 



Hello Thomas,

Thursday, June 2, 2005, 10:20:11 AM, you wrote:

T> I have a bit of strange question: when wanting to insert multiple
T> records into the db, instead of looping through the set and
T> executing mysql_query (which will then call the db n times), is it
T> not better to concat a string with all the insert statements and
T> let mysql handle the inserting, that way we don't call the db n
T> times from php. Does that make any difference?

Sure.. mysql_query doesn't support more than one query in the sql
statement.

If you want to do that then upgrade to PHP 5 (if you're not using it
already) and use mysqli_multi_query instead. I guess packages like
Pear DB may offer similar functionality, but I don't know for certain.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux