Soldato
- Joined
- 4 Jan 2004
- Posts
- 20,802
- Location
- ¯\_(ツ)_/¯
Ok, I've got this loop here that I've done in PHP. Now $filesarr is a huge array with 30,000 or so lines in.
Now, This while loop simply takes each line, splits it up, and attempts to add it to a table in my database. Now this is my first time with SQL, and what is weird about this is that it adds around 33 lines or so, then craps out (Error, insert query failed)
Normally things work or they don't... What am I doing wrong here? am I trying to add too many entries to my table in one go?
Code:
$ca = 0;
$climit = (count($filesarr));
while ($ca < $climit) {
list($file,$fmt,$fsz)=explode('|',$filesarr[$ca]);
$filename = substr(strrchr($file, '\\'), 1);
$path = str_replace("\\", "/", (substr($file, 0, -(strlen($filename)))));
echo $path.'<BR>';
$query = "INSERT INTO filelist (uid, path, filename, size, date) VALUES ('".$ca."', '".$path."', '".$filename."', '".$fsz."', '".$fmt."')";
mysql_query($query) or die ('Error, insert query failed on '.$ca.', '.$path.', '.$filename.', '.$fsz.', '.$fmt); //this is where it all goes wrong
$ca++;
}
Now, This while loop simply takes each line, splits it up, and attempts to add it to a table in my database. Now this is my first time with SQL, and what is weird about this is that it adds around 33 lines or so, then craps out (Error, insert query failed)

Normally things work or they don't... What am I doing wrong here? am I trying to add too many entries to my table in one go?