Re: Using mysql_real_escape_string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux