Steve Angelis Posted February 15, 2008 Share Posted February 15, 2008 I am setting up a blog type of system for a website I am making and I have come across a much needed problem that must get fixed. What is the easiest way to remove quotation marks from posts? Probably when they are detected before entering into the database would be easiest, but any other ways would be good. Link to comment https://forums.phpfreaks.com/topic/91197-quotation-marks/ Share on other sites More sharing options...
mem0ri Posted February 15, 2008 Share Posted February 15, 2008 Use the mysql_real_escape_string function :-) Link to comment https://forums.phpfreaks.com/topic/91197-quotation-marks/#findComment-467393 Share on other sites More sharing options...
Steve Angelis Posted February 15, 2008 Author Share Posted February 15, 2008 How would that work exactly? Link to comment https://forums.phpfreaks.com/topic/91197-quotation-marks/#findComment-467397 Share on other sites More sharing options...
mem0ri Posted February 15, 2008 Share Posted February 15, 2008 mysql_real_escape_string You'll need to have a database connection already open (though I assume that'll be the case as you mentioned you'll be inserting it into a database), and then you'll want to run: $text = mysql_real_escape_string($text); It will replace all special characters with escaped versions that store appropriately in MySQL. Link to comment https://forums.phpfreaks.com/topic/91197-quotation-marks/#findComment-467403 Share on other sites More sharing options...
Steve Angelis Posted February 15, 2008 Author Share Posted February 15, 2008 Ok sounds good. I am assuming that $text is just a variable representing all of the text I want checked out? And is it possible to have it as such, because I am also using BBCode with it and line breaking: nl2br(convert_bbcodes(mysql_real_escape_string($row['blog_message']))) Would that work still? I know the bbcode and line breaking does work with eachother already. Link to comment https://forums.phpfreaks.com/topic/91197-quotation-marks/#findComment-467404 Share on other sites More sharing options...
mem0ri Posted February 15, 2008 Share Posted February 15, 2008 As far as I can see, yes, that should work...and yes, $text is just a variable holding all of your text. Link to comment https://forums.phpfreaks.com/topic/91197-quotation-marks/#findComment-467406 Share on other sites More sharing options...
Steve Angelis Posted February 15, 2008 Author Share Posted February 15, 2008 Ok good. Thanx man Link to comment https://forums.phpfreaks.com/topic/91197-quotation-marks/#findComment-467407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.