Re: [PHP-DB] characters problem

2004-12-20 Thread Panos Yahoo
I finally used the str_replace and now it works! :-)

Thank you all for your help

Panos

"Jochem Maas" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 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" <[EMAIL PROTECTED]>
>>> To: [EMAIL PROTECTED]
>>> Subject: [PHP-DB] 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 "
>>> 
>>> >> alink=#2003CF>
>>> 
>>> 
>>>
>>> Comments>> name=mycomments tabind
>>> ex=22>
>>>
>>> 
>>> 
>>> ";
>>> 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



Re: [PHP-DB] characters problem

2004-12-17 Thread Jochem Maas
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" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP-DB] 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
- 


echo "





Comments


";
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


RE: [PHP-DB] characters problem

2004-12-17 Thread Bastien Koert
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...)

bastien
From: "Panos Yahoo" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP-DB] 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
-

echo "





Comments


";
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