Jump to content

Timeout on PHP Form Upload


iwpg

Recommended Posts

Hello. I have a several hundred records that are imported from a CSV file, and sorted out into an HTML form first. The form is then submitted into a MYSQL database.

 

When submitting the form, I sometimes get a timeout. I was wondering what is the best approach to splitting the data to say 200 records at a time. Any help is appreciated.

Link to comment
https://forums.phpfreaks.com/topic/118552-timeout-on-php-form-upload/
Share on other sites

Thanks, I modifed php.ini to 90 seconds, and increased memory to 32M and rebooted. It still times out at around 30 seconds.

 

Right now, I am adding around 1500 lines with 2 columns. I am thinking that the rows and columns is increasing processing time.

 

I know how to Preg Split single entries per line, but cannot seem to get 2 columns in the database, to 2 fields. 1 row per entry.

 

This is what I have now, and it seems to load much faster:

 

Within a textarea form:

 

Entry 1 Value 1

Entry 2 Value 2

Entry 3 Value 3

(and so on...)

 

My code:

		//Split data
	$data = preg_split('/\r\n|\n/', $_POST['entry'], -1, PREG_SPLIT_NO_EMPTY);

	//Iterate through array
	foreach ($data as $entry) {
		mysql_query("insert into table (entry) values ('$entry')");
	}

Now I think that this is taking the Entry and Value array and combining them. I don't know how I can add "Value" as the corresponding Entry value. I am thinking about a comma delimeter, but I still would not know where to go with the code.

 

Thank you so much. I've been working on the all day, and haven't had any luck.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.