From: | Chris <csmith(at)squiz(dot)net> |
---|---|
To: | arun kv <arun(at)library(dot)iisc(dot)ernet(dot)in>, PGSQL <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: insert a special character |
Date: | 2002-03-28 05:16:27 |
Message-ID: | 5.1.0.14.0.20020328161354.00abcad0@cooee.cybersydney.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Hi,
> I have a string with ' this symbol in the middle of the text
> example:-
> " that book belong to rahul's sister"
>
> this string is to be stored in the variable "$strexp"
> when I am inserting this variable in database table
> following error apperes
>
>
> " parse error at or near "s" "
>
> How can I read the string and store in a variable and insert the same
>into the database table ?
Use the addslashes function.
Basically:
$newstring = addslashes($oldstring);
or
$newstring = addslashes("this is some sampl''e text''");
See http://www.php.net/addslashes for more details.
Then, when you get it out of the database you need to stripslash the
string. (Does the above in reverse).
HTH,
-----------------
Chris Smith
http://www.squiz.net/
From | Date | Subject | |
---|---|---|---|
Next Message | arun kv | 2002-03-28 05:18:56 | insert a special character |
Previous Message | Christopher Kings-Lynne | 2002-03-28 05:15:41 | Re: insert a special character |