What Code To I Need To Use In Php To Use An Apostrophe?
- Forums
- PHP
- What Code To I Need To Use In Php To Use An Apostrophe?
This Page Contains information about What Code To I Need To Use In Php To Use An Apostrophe? By joseph in category PHP with 1 Replies. [1210], Last Updated: Sat May 18, 2024
joseph
Sat Nov 15, 2008
1 Comments
497 Visits
i need your help please please
i have this problem with my php script, im trying to insert data from a hmtl form but sometimes it works and sometimes it doesnt work
so what i have noticed is that whenever i enter comments with an opostrosfi, the data is not entered into mysql, what do i need to do?
mysql_real_escape_string()
oh yeah, i know what you are talking about,
you can actually configure your server to add slashes to your data whenever an apastrophi is entered, so when a user enters any apostrophi into the form and then you enter it with a query, you need to ad a slah.
for example:
$string = wallpaper's are cool at wallpaperama
the way you need to enter that is with:
$string = wallpaper\'s are cool at wallpaperama
but you cant do that manually right. well, the fine folks at php.net gave us a solution.
use the mysql_real_escape_string($string) function
so declare your textarea string with the mysql_real_escape_string function, like this:
$string = mysql_real_escape_string($string)
hope that helps
https://www.wallpaperama.com/forums/what-code-to-i-need-to-use-in-php-to-use-an-apostrophe-t6772.html