exec(" BEGIN TRANSACTION; INSERT INTO " . $table " VALUES (NULL, " . $file[$i] . "); COMMIT; ")){ echo "Failure writing to the database at row" . $i ."!"; $bool = true; break; } } if(!$bool){ echo "Successfull transfered the file into the database."; } } else { echo "No file found!"; }