ryanwood4 Posted June 11, 2009 Share Posted June 11, 2009 I need to strip the slashes from article_title and article_teaser, how do I do this? <?php $con = mysql_connect("localhost","xxxxx","xxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("f1times_articles", $con); $result = mysql_query("SELECT * FROM n2s_article ORDER BY article_id DESC LIMIT 0,15"); echo "<table border='0'> <tr> <th>Latest News</th> </tr>"; while($row = mysql_fetch_array($result)) { $url = $row['article_url'] . "-" . $row['article_id'] . ".html"; echo "<tr>"; echo "<td><h2><a href='$url'>{$row['article_title']}</h2></a>"; echo "<p>{$row['article_teaser']}</p></td>"; } mysql_close($con); ?> Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/161791-solved-stripping-slashes-help/ Share on other sites More sharing options...
Dathremar Posted June 11, 2009 Share Posted June 11, 2009 Use stripslashes($row['article_title')? Stripslashes function php. Link to comment https://forums.phpfreaks.com/topic/161791-solved-stripping-slashes-help/#findComment-853645 Share on other sites More sharing options...
ryanwood4 Posted June 11, 2009 Author Share Posted June 11, 2009 Use stripslashes($row['article_title')? Stripslashes function php. That seems to just add the word stripslashes before the result. Link to comment https://forums.phpfreaks.com/topic/161791-solved-stripping-slashes-help/#findComment-853648 Share on other sites More sharing options...
ryanwood4 Posted June 11, 2009 Author Share Posted June 11, 2009 Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/f1times/public_html/titles.php on line 37 I get this error when using the above suggestion. Link to comment https://forums.phpfreaks.com/topic/161791-solved-stripping-slashes-help/#findComment-853650 Share on other sites More sharing options...
Dathremar Posted June 11, 2009 Share Posted June 11, 2009 <?php $con = mysql_connect("localhost","xxxxx","xxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("f1times_articles", $con); $result = mysql_query("SELECT * FROM n2s_article ORDER BY article_id DESC LIMIT 0,15"); echo "<table border='0'> <tr> <th>Latest News</th> </tr>"; while($row = mysql_fetch_array($result)) { $url = $row['article_url'] . "-" . $row['article_id'] . ".html"; echo "<tr>"; echo "<td><h2><a href='$url'>".stripslashes($row['article_title'])."</h2></a>"; echo "<p>{$row['article_teaser']}</p></td>"; } mysql_close($con); ?> You trying it like this? Link to comment https://forums.phpfreaks.com/topic/161791-solved-stripping-slashes-help/#findComment-853654 Share on other sites More sharing options...
ryanwood4 Posted June 11, 2009 Author Share Posted June 11, 2009 haha, I wasn't! Thank you so very much, its sorted! Link to comment https://forums.phpfreaks.com/topic/161791-solved-stripping-slashes-help/#findComment-853655 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.