|
WDF Senior Member
Join Date: September 2004
Location: Cape Town
Posts: 845
|
I need some help implementing a solution to escape apostrophes and quotations.
I am running MSSQL.
PHP Code:
$first = addslashes(trim(@$_POST['firstname']));
This is the code I am using. If I use single quotes(') it prints this out: jason\'s, and it fails.
But if I use double quotes(") It works and prints this out: jason\"s. Here is the insert statement:
PHP Code:
$sql = "INSERT INTO ClientContact
(CDLID, first, surname, cellno, email, field1, field2, field3)
VALUES
(".$_SESSION['CDLID'].",'".$first."','".$surname."','".$cellno."','".$email."','".$field1."','".$field2."','".$field3."')";
I need a solution for both single and double quotes to work  Thanks in advance
P.S. Ive turned magic quotes off.
Last edited by jbagley; March 8 '05 at 05:40 AM.
|