Problems Entering Apostrophe In Sql Server
RegisterLogin
Problems Entering Apostrophe In Sql Server
Post Description: are you having problems inserting data with the apostrophe character into your sql database like mysql
Tags: problems, entering, apostrophe, in, sql, server
This Post Was Posted On Mar 02, 2010 By Webune Support #3223
Post Description: are you having problems inserting data with the apostrophe character into your sql database like mysql
Tags: problems, entering, apostrophe, in, sql, server
This Post Was Posted On Mar 02, 2010 By Webune Support #3223
Problems Entering Apostrophe In Sql Server by Webune Support
We provide Excellent SQL Database Hosting -
are you having problems inserting data with the apostrophe character into your sql database like mysql
well, if you are using PHP, you can use the mysql_real_escape_string() function to clean you string
for example, this is how you would use it
PHP CODE:
$Foo = "Webune's Hosting is the Best!";
$sql = "INSERT INTO mytable SET this=$Foo";
$sql = "INSERT INTO mytable SET this=$Foo";
if you were to try to execute the $sql query above, it would error out, so to fix it you would do it like this:
PHP CODE:
$Foo = "Webune's Hosting is the Best!";
$sql = "INSERT INTO mytable SET this=". mysql_real_escape_string($Foo)." ";
$sql = "INSERT INTO mytable SET this=". mysql_real_escape_string($Foo)." ";
or
PHP CODE:
$Foo = mysql_real_escape_string("Webune's Hosting is the Best!");
$sql = "INSERT INTO mytable SET this=$Foo";
$sql = "INSERT INTO mytable SET this=$Foo";
Leave Your Comments
©2011 Webune Forums - Sun Dec 18, 2011 6:27 pm
Powered by: Webune Forums V3
Powered by: Webune Forums V3