The fact that you are calling stripslashes tells me that one of two
things has occurred.

#1.
You escaped data coming into the DB *twice*, which often happens with
Magic Quotes GPC + (addslashes || mysql_real_escape_string) used
together.
Your data is corrupt, and until you fix that, you'll just have
nightmares.

#2.
You just don't understand the purpose of escaping data to go into MySQL.

The purpose of the escaping is not to STORE the data with extra slashes.

The purpose is to add extra slashes so that MySQL parser/reader can
"eat" them and end up with the correct raw data you had before you
escaped it.




RIGHT WAY
Raw Data     Escaped Data     What MySQL puts on hard drive
can't        can\'t           can't

WRONG WAY
Raw Data     Doubly-escaped   What MySQL puts on hard drive
can't        can\\\'t         can\'t

If you're getting can\'t "out" of MySQL with mysql_fetch_row, then you
are in situation #1.

If you don't but you are calling stripslashes() anyway, you are in
situation #2

On Fri, June 30, 2006 3:14 pm, Don wrote:
> Ok, better but stil not displayting properly.
> Here is what my database field has:
>
> import.csv'<">/\
>
> Here is what is displaying:
>
> import.csv'</\" size="40" maxlength="40" onkeypress="return
> noenter()">
>
> It's choking on the double quote in the database field. Here is the
> code
> snippet from my form:
>
> <input type="text" name="email" value="<?php echo
> display_database($db_accounting->Email); ?>" size="50"></td>
>
> function display_database($value)
> {
>    $value = htmlentities($value,ENT_COMPAT);
>    if (!get_magic_quotes_gpc()) {
>        $value = stripslashes($value);
>    }
>    return $value;
> }
>
> -----Original Message-----
> From: Stut [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 30, 2006 3:49 PM
> To: Don
> Cc: php list
> Subject: Re: [PHP] Displaying data from a MySLQ table
>
> Don wrote:
>> Hi Have have a varchar field in a MySQL database which contains the
>> following
>>
>> 905.362.6000"l""s"'L'
>>
>> I am trying to display it on my web page in a <INPUT="TEXT"> field
>> but
>> all I see is:
>>
>> 905.362.6000
>>
>> I am wondering why the trailing characters do not display even
>> though
>> they are present in the database when I check using PhpMyAdmin.
>> Please
> help.
>
> You need to run the value through htmlentities
> (http://php.net/htmlentities).
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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

Reply via email to