im trying to make a forum system, but how do i do the following:
-Replace 'returns' in the text box with <br> (so stuff is on seperate lines)
-Insert text which has stuff like ' " ) without ruiining the sql code.
hope you can help
Tom
safely adding text into a database
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Yes and then when you've selected it from the database and want to display it:
http://www.php.net/stripslashes
http://www.php.net/htmlspecialchars
http://www.php.net/nl2br
Mac
http://www.php.net/stripslashes
http://www.php.net/htmlspecialchars
http://www.php.net/nl2br
Mac
magic_quotes_gpc = On
If you can put
magic_quotes_gpc = On
in your php.ini file, you don't have to do string escape. Just put your input string into SQL query, PHP will convert it automatically.
However, when you put them back to web page, use htmlspecialchars() and nl2bar() to decode them porperly.
magic_quotes_gpc = On
in your php.ini file, you don't have to do string escape. Just put your input string into SQL query, PHP will convert it automatically.
However, when you put them back to web page, use htmlspecialchars() and nl2bar() to decode them porperly.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK