Re: insert a special character

Поиск
Список
Период
Сортировка
От Chris
Тема Re: insert a special character
Дата
Msg-id 5.1.0.14.0.20020328161354.00abcad0@cooee.cybersydney.com.au
обсуждение исходный текст
Ответ на insert a special character  (arun kv <arun@library.iisc.ernet.in>)
Список 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/


В списке pgsql-php по дате отправления:

Предыдущее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: insert a special character
Следующее
От: "PG Explorer"
Дата:
Сообщение: Re: insert a special character