How To insert apostrophe MySQL PHP

RegisterLogin
How To insert apostrophe MySQL PHP
Post Description: I Am Trying To Insert The Post Data From My Php Form Into Mysql Db To Insert Special Characters, Like The "apostrophe" Read The Section On String
Tags: How, To, Insert, Apostrophe, Mysql, Php
This Post Was Posted On Jan 11, 2010 By Junki1999 #3039
How do you insert text with apostrophe into a mysql table? I am using PHP and MySQL table to insert data into my database, but when i submit the HTML form, it works except the problem happens when i try to enter the apostrophe (') charater into the SQL database. so how do i dela with insterting apostrophe's characters.

i have tried all the tricks, but none seem to work. although, i must say that i am new to php and mysql so if you can show me how to sql insert string apostrophe using php mysql to insert apostrophe that would be great. i will try to learn more about sql server and how to insert apostrophes. i do have a little expirience in oracle sql insertion but never run into a problem with apostrophe, only with quotes, i did but i was able to use the htmlentities() function, and that worked. but now its the sql insert with apostrophe issue.

please help





Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
nad
#9708 1
it work for me!....thnk!..
May 08, 2012 Reply Report abuse
subhash
#9592 2
thank you dear thank you..
Mar 21, 2012 Reply Report abuse
ulof
#4968 3
i had the same problem with the same database
Apr 06, 2011 Reply Report abuse
lopos
#3388 4
the method with post and apostrophe in html form not working is this because of the way i am sending the data?
Feb 01, 2010 Reply Report abuse
handsor
#3365 5
how to insert special characters, like the "apostrophe" in my sql
Jan 30, 2010 Reply Report abuse
webune
#3230 6

mysql_real_escape_string()


you need to use mysql_real_escape_string() function to escape all the characters in your database

for example:

$foo = "This is a Webune's Tutorial";

$sql = "INSERT INTO mytable SET comments = '".mysql_real_escape_string($foo)."'";


you see?
Jan 11, 2010 Reply Report abuse
Leave Your Comments...
©2013 Webune Forums - Sat May 04, 2013 12:32 am
Powered by: Webune Forums V3