August 31st, 1999, 12:28 PM
When I enter text into a form with an apostrophe and submit it. I then attempt to enter it into a database via a query. I receive an error about unclosed quotes. So I checked the variable and slashes are being put in front of all apostrophe's. I have tries addslashes and stripslashes with no luck.I am working with MSSQL not MYSQL.
[This message has been edited by Raistlin (edited 08-31-99).]
September 1st, 1999, 05:04 PM
addslashes() should be the function you need.
Make sure you are using
$var = addslashes($var);
September 21st, 1999, 05:54 PM
Maybe the slash is not working for M$SQL.
Try adding a second apostrophe to each one:
$name = str_replace("'", "''", $name);
if name = "D'ALMASSO", it works "D''ALMASSO" to query the database.