Re: Using mysql_real_escape_string

From: Date: Tue, 10 Oct 2006 21:15:47 +0000
Subject: Re: Using mysql_real_escape_string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-242943@lists.php.net to get a copy of this message
On Mon, October 9, 2006 1:53 pm, Alan Milnes wrote: > $filename="input/w2wcheck.txt"; > > echo "<h2>$filename</h2>"; > > # Open file > $fptr = fopen($filename, "r"); > > # Check if file is open > if($fptr) { > $current_line = fgets($fptr,4096); > > $retval = TRUE; > echo "open"; > > while($current_line && $retval) > { It *might* be slightly faster/better to do: array_walk($current_line, 'mysql_real_escape_string') if you're sure you're not going to use $current_line for anything other than putting the data into SQL. If this is a CSV file, you may want to use fgetcsv() as it will handle the grungy details of embedded commas and quotes and spiders and snakes. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#242943) next »