RE: Multiple inserts as a single string?

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

 



> 
> Thanks Richard that makes it clear.
> 
> Thomas
> 
> 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 executing 
> T> mysql_query (which will then call the db n times), is it 
> not better 
> T> to concat a string with all the insert statements and let mysql 
> T> handle the inserting, that way we don't call the db n 
> times from php. 
> T> Does that make any difference?

Inserting multiple rows with one INSERT statement is part of the SQL standard (IIRC), and MySQL supports it.

INSERT INTO table(a,b) VALUES (1,1), (2,2), (3,3), ... ,(n, n)


Jared

-- 
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