Re: characters problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I finally used the str_replace and now it works! :-)

Thank you all for your help

Panos

"Jochem Maas" <jochem@xxxxxxxxxxxxx> wrote in message 
news:41C3620E.4050305@xxxxxxxxxxxxxxxx
> Bastien Koert wrote:
>> Two years and you haven't heard of:
>>
>> addslashes?
>> mysql_reaL_escape_string?
>>
>> or even something as simple as
>>
>> $comments = str_replace("'","''",$comments);
>>
>> to replace the one quote with two single quotes (don't forget to remove 
>> them on the display...)
>
> I thount that the first single-quote escapes the second and only 1 is 
> stored..... so I took 2 seconds to type 'mysql.com single quote' into 
> google and ...
>
> well check out: http://dev.mysql.com/doc/mysql/en/String_syntax.html
> (personally I think the style & CS on the site makes some of the 
> information hard to digest)
>
> good luck.
>
>
>>
>> bastien
>>
>>> From: "Panos Yahoo" <grshadowgr@xxxxxxxxx>
>>> To: php-db@xxxxxxxxxxxxx
>>> Subject:  characters problem
>>> Date: Fri, 17 Dec 2004 09:38:15 +0200
>>>
>>> Dear All,
>>>
>>> I am using php and mysql the last two years, and I still cannot find the 
>>> way
>>> to update a field on mysql from php that containts the single quotes ( ` 
>>> and
>>> ' )
>>>
>>> Examples
>>>
>>> Here is an example of my index.php file. I have to type something on
>>> "Comments" field
>>> -----------------------------------------------------------------------------
>>>
>>> <?
>>> include("../configs/dates.inc");
>>> include("../configs/config.inc");
>>>
>>> echo "
>>> <br>
>>> <body bgcolor=#FFF8E1 text=#2003CF link=#2003CF vlink=#2003CF 
>>> alink=#2003CF>
>>> <center>
>>> <form method=post action=add.php>
>>>
>>> <font face=\"Comic Sans MS\">Comments<br><textarea rows=3 cols=40
>>> name=mycomments tabind
>>> ex=22></textarea>
>>>
>>> <input type=submit name=Submit value=\"Add Ticket\">
>>> <input type=reset name=Reset value=\"Clear Form\">
>>> ";
>>> mysql_close($myconn);
>>>
>>> ?>
>>> -----------------------------------------------------------------------------
>>>
>>>
>>>
>>>
>>>
>>> In the html text area, I am typing the following text : Hello My name is
>>> Panos and I'm from Greece
>>>
>>>
>>>
>>>
>>> The add.php file looks like this :
>>> -----------------------------------------------------------------------------
>>>
>>> <?
>>>
>>> include("../configs/dates.inc");
>>> include("../configs/config.inc");
>>>
>>>
>>>
>>> $myquery="INSERT INTO `$table` (`comments`) VALUES ('$mycomments')";
>>>
>>> $myresult=mysql_db_query($db,$myquery);
>>>
>>> mysql_close($myconn);
>>>
>>> echo "done";
>>>
>>> ?>
>>> -----------------------------------------------------------------------------
>>>
>>>
>>>
>>>
>>> ANd when i'm trying to see what was added on mysql, i have the following
>>> result :
>>>
>>> Hello My name is Panos and I\
>>>
>>>
>>>
>>> -----------------------------------------------------------------------------
>>>
>>>
>>> The field on mysql is TEXT
>>>
>>> Does anyone knows how can i resolve this problem?
>>>
>>> Thanks
>>>
>>> Panos
>>>
>>> -- 
>>> PHP Database Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux