You are here: RE: [PHP] Multiple inserts as a single string? « PHP « IT news, forums, messages
RE: [PHP] Multiple inserts as a single string?

Posted by "Thomas" on 06/02/05 14:36

Thanks Richard that makes it clear.

Thomas

-----Original Message-----
From: Richard Davey [mailto:rich@launchcode.co.uk]
Sent: 02 June 2005 12:43 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Multiple inserts as a single string?

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация