|
Posted by Paul on 10/10/06 01:02
"Johnny" <removethis.huuanito@hotmail.com> wrote in message
news:vATVg.928$UJ2.571@fed1read07...
>
> "Paul" <notreallyme@nowhere.invalid> wrote in message
> news:hBQVg.393$O65.0@bignews5.bellsouth.net...
>> I have a string coming from a tinytext field in MySQL like:
>>
>> <font
>>
> color="#000000">s<strike><b>ss<u>s<i>sss</i></u></b></strike><u>ss</u>sss<st
> rike>sssssss</strike></font><font
>> color="#000000"><strike>ssss</strike>sssss</font>
>>
>> I get that field in a mysql query and reference it like:
>>
>> echo strip_tags($row[4]);
>> It renders the same line without stripping any tags:
>> <font
>>
> color="#000000">s<strike><b>ss<u>s<i>sss</i></u></b></strike><u>ss</u>sss<st
> rike>sssssss</strike></font><font
>> color="#000000"><strike>ssss</strike>sssss</font>
>>
>> I tried casting it as a string just to make sure, no difference.
>>
>> If I take that string, assign it manually to a variable and strip-tags,
>> it
>> works:
>> $v = '<font
>>
> color="#000000">s<strike><b>ss<u>s<i>sss</i></u></b></strike><u>ss</u>sss<st
> rike>sssssss</strike></font><font
>> color="#000000"><strike>ssss</strike>sssss</font>';
>> echo strip_tags;
>> Any ideas how I can get it to propoerly strip tags from the database?
>>
>>
>
> Who knows what you are doing wrong... works for me, I did this:
> <?php
> include_once "ini.php"; # init theDB defines
> include_once "class.db.php";
> $db = new class_db(DB_USER,DB_PASSWORD,DB_NAME,DB_HOST,SHOW_ERRORS);
> $text = '<font
> color="#000000">s<strike><b>ss<u>s<i>sss</i></u></b></strike><u>ss</u>sss<st
> rike>sssssss</strike></font><font
> color="#000000"><strike>ssss</strike>sssss</font>';
> $sql = "INSERT events SET testee=".$db->quote_smart($text);
> $insert= $db->insert($sql,"test");
> $row = $db->fetch_one_row("SELECT testee FROM events WHERE
> id=$insert","");
> echo "here:<br />".strip_tags($row['testee']);
> ?>
>
> and it produced:
> here:
> ssssssssssssssssssssssssssss
>
> in the browser and as the source of that:
> here:<br />ssssssssssssssssssssssssssss
>
> so works for me....
It turns out pear was set for sanitizing data. I encoded then decoded the
string and it worked
thanks guys
Navigation:
[Reply to this message]
|