Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
shivam0101
Forum Contributor
Posts: 197 Joined: Sat Jun 09, 2007 12:09 am
Post
by shivam0101 » Fri Oct 19, 2007 12:18 pm
I am inserting some data into a database table. It contains 4 fields. The insertion is done by using a loop. If the data to be inserted is 100-150 rows, will the server hang?
example//
Code: Select all
foreach($datas as $data_key=>$data_value)
{
mysql_query("INSERT INTO table SET data_key='$data_key', data_value='$data_value'");
}
califdon
Jack of Zircons
Posts: 4484 Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA
Post
by califdon » Fri Oct 19, 2007 2:24 pm
I see no reason to expect the server to hang, you're just sending it a bunch of short queries.
Christopher
Site Administrator
Posts: 13596 Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US
Post
by Christopher » Fri Oct 19, 2007 6:57 pm
Try "LOAD DATA INFILE..." instead.
(#10850)