Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 02-04-2005, 04:11 PM   PM User | #1
jonathan7799
New to the CF scene

 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
jonathan7799 is an unknown quantity at this point
HTML with MySQL > and <

Hi,

My trouble is this.

I have a Perl script accessing a MySQL database that contains a veriety of things as well as HTML content.

My Perl creates an interface for editing the HTML content, everything is find up until I add &lt; or &gt; which is part of the content and not part of the html, what it does during edit is display the &gt; as < rather than just leave it alone as I would like...Also, the content is written in HTML, so it must leave alone < and > as they are, as well as &gt; and &lt; without conversion.

Then when the edit is complete and the content displayed it thinks that whats held between the <> is html code and doesn't display it....

I realise that it is the browser thats doing this, but surely there is a way to either stop it or protect the symbols...

Can anyone help with this.....

Jonathan

P.S. Incidentally, I notice that this system doesn't have this problem, though I do not wish to move to PHP at this point....

Last edited by jonathan7799; 02-04-2005 at 04:15 PM..
jonathan7799 is offline   Reply With Quote
Old 02-04-2005, 04:17 PM   PM User | #2
Horus Kol
Regular Coder

 
Join Date: Nov 2004
Location: Somewhere over the rainbow
Posts: 208
Thanks: 0
Thanked 0 Times in 0 Posts
Horus Kol is an unknown quantity at this point
if you had &amp;gt; that will fix it...

i guess that & is replaced by &amp; when it is entered into the database here at coding forums...
__________________
Questions are what binds the universe,
Questions lead to answers,
Answers lead to knowledge,
Knowledge leads to wisdom,
Wisdom brings more questions -- Horus Kol, 2004 :)
Horus Kol is offline   Reply With Quote
Old 02-04-2005, 04:22 PM   PM User | #3
jonathan7799
New to the CF scene

 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
jonathan7799 is an unknown quantity at this point
&amp;gt;

I tried &amp;gt; ...

It goes through the edit once, but on second edit it is converted goes like this...

&amp;gt; then &gt; then >

am I missing something in the Perl...

Jonathan
jonathan7799 is offline   Reply With Quote
Old 02-04-2005, 04:46 PM   PM User | #4
Horus Kol
Regular Coder

 
Join Date: Nov 2004
Location: Somewhere over the rainbow
Posts: 208
Thanks: 0
Thanked 0 Times in 0 Posts
Horus Kol is an unknown quantity at this point
ah...

right...


when you submit the form, and before it gets entered into the database, you need to replace any & symbols with &amp;

that way, when it is displayed again it will only look like &, but will again be entered into the database as &amp;
__________________
Questions are what binds the universe,
Questions lead to answers,
Answers lead to knowledge,
Knowledge leads to wisdom,
Wisdom brings more questions -- Horus Kol, 2004 :)
Horus Kol is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:23 AM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.