Stripping control M character (^M)

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

 



Hello All,

I'm having some issues with carriage returns. Specifically the control M
character (^M). I have attempted to clean and validate the file I'm
creating. Here's the code.

 while ($row = mysql_fetch_array($result)){

    // assign and clean vars
    $artist = trim($row[artist]);
    $tdDate = trim($row[start_date]);
    $venue = trim($row[venue]);
    $city = trim($row[CITY]);
    $state = trim($row[STATE]);
    $country = trim($row[COUNTRY]);
    $tdId = trim($row[td_id]);

    // create string

    $line = "$artist|||$tdDate||$venue|$city|$state|$country|$tdId\n";

    // validate the string

   if(preg_match("/.*.|||.*.||.*.|.*.|.*.|.*.|.*.n\//", $line)){
       // record is correct so write line to file
       fwrite($handle,$line);
   }




}


So ^M slips right by trim and my preg_match line.

Any ideas??

TIA
-- 
Paul Nowosielski
Webmaster CelebrityAccess.com
Tel: 303.440.0666 ext:219 
Cell: 303.827.4257

-- 
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