Re: More info on timeout problem, with code

From: Date: Wed, 07 Nov 2007 12:00:35 +0000
Subject: Re: More info on timeout problem, with code
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-264170@lists.php.net to get a copy of this message
Jon Westcot wrote: > Hi Chris: > ... > That is, I need to close the single quote, place a comma after the > field, and then add in another opening quote. One other thing: I suspect I > need to use addslashes() to the elements in $data -- is there a way to do > this with one statement as you've done above? something like: "INSERT INTO foo (fields) VALUES ('".join("','", array_map('mysql_real_escape_string', $data)."')"; > >> Also as someone else suggested if this is a csv file you >> can use LOAD DATA INFILE to directly import it instead >> of having to create a bunch of insert queries. >> >> See http://dev.mysql.com/doc/refman/5.1/en/load-data.html >> >> Only do this if you are 100% sure of the data (ie it it sanitized in >> some other step). > > Trying to use LOAD DATA INFILE was my initial plan, but that simply > didn't work. Turns out that it's because of being on a shared server. I've > talked with The Powers That Be about this and they're going to move to a > dedicated virtual server; that should give me much more flexibility and > control over what I need to update in the various settings and files and > things to get past all of the heartburn I've had over the last weeks. > >>> As odd as this sounds, should I put in some type of >>> delay? Could the system be thinking it's getting flooded >>> by all of the inserts? >> Doubt it. > > Surprisingly enough, when I've used something like usleep(15000), I seem > to be able to process more records than when I don't have it at all. > ::shrug:: Just clutching at straws. > > Thanks again for your comments. I appreciate them all! > > Jon >

« previous php.general (#264170) next »