Is it possible to make a php form change the symbol ' to ' when submitted?
When I try to search for ' on google it changes it to a ' so I don't get the correct search results to help me out.
Thanks.
php change ' to '
Moderator: General Moderators
-
ldougherty
- Forum Contributor
- Posts: 103
- Joined: Sun May 03, 2009 11:39 am
Re: php change ' to '
What exactly are you trying to write it to? A database or output via HTML etc?
Re: php change ' to '
I am storing a description of games on my website, when I write ' it messes up the insertion of the mysql script so I have to write ' which works! I just wanted to be able to write ' insted of ' and the php script automatically change ' to ' before inserting into the database...
-
ldougherty
- Forum Contributor
- Posts: 103
- Joined: Sun May 03, 2009 11:39 am
Re: php change ' to '
If I understand you correctly you likely have a field that is writing to the database and the input includes ' which breaks the query.
You should check out mysql_real_escape_string which escapes special characters in a string for use in a SQL statement
http://us3.php.net/mysql_real_escape_string
You should check out mysql_real_escape_string which escapes special characters in a string for use in a SQL statement
http://us3.php.net/mysql_real_escape_string
Re: php change ' to '
u can use addslashes function before inserting into database and stripslashes function before displaying the content in a page...