Hi,
I got a huge file, that I want to open using php, then process line by line, and saving data to the database.
Importing directly ot mySql is not an option, as I have to do some processing on each line, like converting the case, and seeing if and to which table data have to go.

At the moment, I cant do this as the script gives an timeout error.
Code:
	$fd = fopen ($filename, "r");
	// initialize a loop to go through each line of the file
	while (!feof ($fd)) {
		$buffer = fgetcsv($fd, 4096); // declare an array to hold all of the contents of each
		//row, indexed
		$country_code = $buffer[2];
		$country = $buffer[3];
		$region = $buffer[4];
		$city = $buffer[4];
		$country_code = $buffer[2];
		//figure out what to do with the data and insert to database if not exist
		//does the country exists?  if not, put it in country table
		//does the region exists?  if not, put in region table
		//does the city exists?  if not,put in city table		
	}
	fclose ($fd);