Page 1 of 1

Inserting many rows

Posted: Fri Oct 19, 2007 12:18 pm
by shivam0101
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'");
 }

Posted: Fri Oct 19, 2007 2:24 pm
by califdon
I see no reason to expect the server to hang, you're just sending it a bunch of short queries.

Posted: Fri Oct 19, 2007 6:57 pm
by Christopher
Try "LOAD DATA INFILE..." instead.