I have this to insert query outside a loop to save memory
$z = "";
foreach($link as $i)
{
//some stuff
$z .= "('" . $s . "', '" . $data . "', '" . $data2 ."'), ";
}
$z = substr($z, 0, strlen($z) - 2);
mysql_query("INSERT INTO table VALUES ".$z."");
Which works ok if the loop only loops 1 anything after that i get a mysql error, is there something wrong with it?