Removing Returns / New Lines / Tabs / Extra Spaces from DB Results

From: Date: Thu, 08 May 2003 02:37:26 +0000
Subject: Removing Returns / New Lines / Tabs / Extra Spaces from DB Results
Groups: php.general 
Request: Send a blank email to php-general+get-146775@lists.php.net to get a copy of this message
I have a form with a textarea that allows for description and people can put in returns. How can I remove the returns once the content has already been submitted to the database prior to writing the information to a tab delimited text file? I have tried trim, ltrim, rtrim, and eregi_replace to remove \n, \r, and \t, but it has not worked. Example code is below. If I echo $trim_desc to the browser, it trims the text, but it does not trim it when written to the text file. Any suggestions? TIA. ---- Code ---- $file = "link_test.txt"; $op_file = fopen($file,"w+"); if($op_file) { while($row = mysql_fetch_array($getlinks)) { $category = $row['category_name']; $link_name = $row['link_name']; $url = $row['link_URL']; $trim_desc = rtrim($row['Description'],"\r\n\t"); fwrite($op_file,"$category\t$link_name\t$url\t$trim_desc\n"); } } ---- End Code ---- ---------- Jami Moore jami@jamisniche.com http://designsby.jamisniche.com/

« previous php.general (#146775) next »