You are here: Re: [PHP] problem with ' or " « PHP « IT news, forums, messages
Re: [PHP] problem with ' or "

Posted by George B on 08/24/05 08:54

Jasper Bryant-Greene wrote:
> George B wrote:
>
>> Jasper Bryant-Greene wrote:
>>
>>> George B wrote:
>>>
>>>> I made a script that posts data into a database but it has a problem
>>>> whenever I enter a ' or a ". How do I bypass this problem?
>>>
>>>
>>> If it is MySQL, use mysql_real_escape_string() [1]. If any other
>>> database, have a look in the PHP manual [2] for the relevant
>>> function, or as a last resort use addslashes().
>>>
>>> Jasper
>>>
>>> [1] http://www.php.net/mysql_real_escape_string
>>> [2] http://www.php.net/docs.php
>>
>>
>> Where do I put the code in?
>>
>
> Example:
>
> $value = mysql_real_escape_string($_POST['value']);
> $results = mysql_query("SELECT * FROM sometable WHERE field='$value'");
>
> Jasper
THANKS!! it works!!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация