zerGinfested Posted February 26, 2010 Share Posted February 26, 2010 Grabbing the Body row from my table is giving me a MAJOR headache here. it is littered with forward slashes infront of quotes ( /" where it should just be " ) as well as r/n/ where <br>'s should be. I've tried str_replacing them both but to no avail. It simply returns them all the same. Is there a simple error in my code that I'm missing? Let's hope so if(isset($id)){ $query = "SELECT * FROM news where id='$id'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); $body = $row[body]; str_replace('\r\n', '<br>', $body); print "<div class='articletitle'>$row[title]</div><br /> <div class='maintext'><em>Released $row[date]</em><br><br>$body</div>"; } Quote Link to comment Share on other sites More sharing options...
schilly Posted February 26, 2010 Share Posted February 26, 2010 check the data in the db. if it has too many slashes to escape quotes etc then there is a problem when you are entering the data into the db. Quote Link to comment Share on other sites More sharing options...
zerGinfested Posted February 26, 2010 Author Share Posted February 26, 2010 check the data in the db. if it has too many slashes to escape quotes etc then there is a problem when you are entering the data into the db. I'm using a wysiwyg so clients can copy and paste from their word processors (which I know is headache enough) but yes, it is creating the /r/n right from the get go. Should i be doing the str_replace before it is entered in the db, rather than when it is pulling it? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.