0) { $return.='INSERT INTO ' . $table . ' VALUES'; for ($i=0; $i<$num_fields; $i++) { $x = 0; while ($row=mysql_fetch_row($result)) { $x++; if ($x == 1) { $return .= "\n("; } else { $return .= "),\n("; } for ($j=0; $j<$num_fields; $j++) { $row[$j]=addslashes($row[$j]); $row[$j]=str_replace("\n", "\\n", $row[$j]); if (isset($row[$j])) { $return.='"' . $row[$j] . '"'; } else { $return.='""'; } if ($j<($num_fields-1)) { $return.=','; } } } } $return.=");\n"; } return $return; }