|
Posted by Richard Davey on 06/02/05 13:42
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
Navigation:
[Reply to this message]
|