My code below is supposed to automate insertion of a CSV into a database. Howvever, if the input file contains more than 10 lines, the database supposedly corrupts with the message, "database disk image is malformated".
$db->exec('BEGIN;');
while(!feof($data)) {
$line = fgets($data);
$tmp = split(",", $line);
$query = "INSERT INTO calendar_dates VALUES (
'$tmp[0]','$tmp[1]',$tmp[2])";
$db->exec($query);
if (!$results) {
exit ("Error<br>");
}
}
$db->exec('COMMIT;');