07-16-2009, 01:43 PM
|
#2 (permalink)
|
|
The Addict
Join Date: Aug 2008
Posts: 336
Thanks: 8
|
You can loop to concatenate the query string and then query at the end, that way there is not a lot of sequential queries, but just one.
PHP Code:
$query = 'INSERT INTO thetable(column1, column2, column3, column4) ';
//$assuming the data is comming from a db query.
while ($row = mysql_fetch_assoc($rs)) {
$query .= 'VALUES('.$row['name'].', '.$row['city'].', '.$row['special_number'].', '.$row['code'].') ';
}
$result = mysql_query($query) or die(mysql_error());
|
|
|
|