I have a batchcode.txt which contains list of batch code.
645863
302422
430307
821773
599738
671768
732159
and so on
I have a table in my database which is called batchcode with fields 'id','batchcode'.
My problem is it wont insert my text file into my table called batchcode. I already did the import and select table but nothing works...
I need some help can anyone help me please.
<?php
$host= "localhost";
$user= "root";
$pass= "";
$db="klayton";
$connect= mysql_connect($host,$user,$pass);
if (!$connect)die ("Cannot connect!");
mysql_select_db($db, $connect);
$file = fopen("batchcode.txt","r");
while(! feof($file))
{
$sql = "INSERT INTO batchcode( batchcode ) VALUES ('fgets($file)')"; //Insert every read line from txt to mysql database
mysql_query($sql);
}
fclose($file);
?>
I got an error that says "Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\test\index.php on line 22"