Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.