I have a file which I need to import into my database but I like to import 10 record at a time.
e.g. I have 100 records in my .csv file so first time it runs it will start from 0 then it will goto 10 and changes the your to domain.com/importfile.php/?start=10
this is the code I use.
$file = fopen($file, "r");
while (($data = fgetcsv($file, 8000, ",")) !== FALSE) {
$county = new County();
$county->countrycode = $countrycode;
$county->code = trim($data[0]);
$county->var_name = $county->mod_write_check( trim($data[1]) );
$county->name = trim($data[1]);
$county->statecode = trim($data[2]);
$save = $county->save();
}
fclose($file);
I would like to know if this can be done.