href in mysql databse
am 22.08.2007 00:36:03 von Matt Barbadian
I have a html link in a mysql database field that is getting queried
using PHP. My problem is when the page is rendered, the link displays
the html not an actual clickable link. Any help would be greatly
appreciated.
Thanks
Re: href in mysql databse
am 22.08.2007 02:58:22 von zeldorblat
On Aug 21, 6:36 pm, Matt Barbadian wrote:
> I have a html link in a mysql database field that is getting queried
> using PHP. My problem is when the page is rendered, the link displays
> the html not an actual clickable link. Any help would be greatly
> appreciated.
>
> Thanks
Tough to say what the problem might be -- you haven't provided any of
your code.
Re: href in mysql databse
am 22.08.2007 11:41:12 von Captain Paralytic
On 22 Aug, 01:58, ZeldorBlat wrote:
> On Aug 21, 6:36 pm, Matt Barbadian wrote:
>
> > I have a html link in a mysql database field that is getting queried
> > using PHP. My problem is when the page is rendered, the link displays
> > the html not an actual clickable link. Any help would be greatly
> > appreciated.
>
> > Thanks
>
> Tough to say what the problem might be -- you haven't provided any of
> your code.
Seconded
Re: href in mysql databse
am 22.08.2007 18:08:05 von Matt Barbadian
On Aug 22, 2:41 am, Captain Paralytic wrote:
> On 22 Aug, 01:58, ZeldorBlat wrote:
>
> > On Aug 21, 6:36 pm, Matt Barbadian wrote:
>
> > > I have a html link in a mysql database field that is getting queried
> > > using PHP. My problem is when the page is rendered, the link displays
> > > the html not an actual clickable link. Any help would be greatly
> > > appreciated.
>
> > > Thanks
>
> > Tough to say what the problem might be -- you haven't provided any of
> > your code.
>
> Seconded
This is the PHP i'm using to talk with the mysql database:
require_once('../../includes/scripts/db_connector.php');
$connector = new DB_Connector();
$result = $connector -> query('SELECT * FROM questions WHERE topic_id
= 0');
echo 'Questions: Top 5';
echo '';
while($row = $connector -> fetchArray($result)) {
echo ''.$row['question'].'
';
echo nl2br(''.$row['answer'].'
');
echo '';
echo '';
}
?>
The problem is i have this for example in
one of the fields in the mysql database. When the page loads it shows
the html NOT a clickable link.
Re: href in mysql databse
am 22.08.2007 18:21:48 von Shion
mbarbs wrote:
> On Aug 22, 2:41 am, Captain Paralytic wrote:
>> On 22 Aug, 01:58, ZeldorBlat wrote:
>>
>>> On Aug 21, 6:36 pm, Matt Barbadian wrote:
>>>> I have a html link in a mysql database field that is getting queried
>>>> using PHP. My problem is when the page is rendered, the link displays
>>>> the html not an actual clickable link. Any help would be greatly
>>>> appreciated.
>>>> Thanks
>>> Tough to say what the problem might be -- you haven't provided any of
>>> your code.
>> Seconded
>
> This is the PHP i'm using to talk with the mysql database:
>
>
> require_once('../../includes/scripts/db_connector.php');
> $connector = new DB_Connector();
> $result = $connector -> query('SELECT * FROM questions WHERE topic_id
> = 0');
> echo 'Questions: Top 5';
> echo '';
> while($row = $connector -> fetchArray($result)) {
> echo ''.$row['question'].'
';
> echo nl2br(''.$row['answer'].'
');
> echo '';
> echo '';
> }
> ?>
>
> The problem is i have this for example in
> one of the fields in the mysql database. When the page loads it shows
> the html NOT a clickable link.
The problem is how you store the value to the database, you most likely used
htmlentities() or a simialr function on the string before you stored it, which
makes it to be displayed as it's written and not parsed by the browser as
html-code.
--
//Aho
Re: href in mysql databse
am 22.08.2007 18:32:58 von Matt Barbadian
On Aug 22, 9:21 am, "J.O. Aho" wrote:
> mbarbs wrote:
> > On Aug 22, 2:41 am, Captain Paralytic wrote:
> >> On 22 Aug, 01:58, ZeldorBlat wrote:
>
> >>> On Aug 21, 6:36 pm, Matt Barbadian wrote:
> >>>> I have a html link in a mysql database field that is getting queried
> >>>> using PHP. My problem is when the page is rendered, the link displays
> >>>> the html not an actual clickable link. Any help would be greatly
> >>>> appreciated.
> >>>> Thanks
> >>> Tough to say what the problem might be -- you haven't provided any of
> >>> your code.
> >> Seconded
>
> > This is the PHP i'm using to talk with the mysql database:
> >
>
> > require_once('../../includes/scripts/db_connector.php');
> > $connector = new DB_Connector();
> > $result = $connector -> query('SELECT * FROM questions WHERE topic_id
> > = 0');
> > echo 'Questions: Top 5';
> > echo '';
> > while($row = $connector -> fetchArray($result)) {
> > echo ''.$row['question'].'
';
> > echo nl2br(''.$row['answer'].'
');
> > echo '';
> > echo '';
> > }
> > ?>
>
> > The problem is i have this for example in
> > one of the fields in the mysql database. When the page loads it shows
> > the html NOT a clickable link.
>
> The problem is how you store the value to the database, you most likely used
> htmlentities() or a simialr function on the string before you stored it, which
> makes it to be displayed as it's written and not parsed by the browser as
> html-code.
>
> --
>
> //Aho
Aho,
How would you recommend the best way to do this?
Re: href in mysql databse
am 22.08.2007 19:35:07 von Shion
mbarbs wrote:
> On Aug 22, 9:21 am, "J.O. Aho" wrote:
>>> The problem is i have this for example in
>>> one of the fields in the mysql database. When the page loads it shows
>>> the html NOT a clickable link.
>> The problem is how you store the value to the database, you most likely used
>> htmlentities() or a simialr function on the string before you stored it, which
>> makes it to be displayed as it's written and not parsed by the browser as
>> html-code.
> How would you recommend the best way to do this?
>
If you use a form to input the data, you may need to use
html_entity_decode() to get rid of all htm encoded characters (you don't want
those)
Before you store data into the database, you want to run addslashes(), this
prevents problems with " or ' in the strings.
And when you fetched the data from the database, use stripslashes(), before
you echo things out.
--
//Aho
Re: href in mysql databse
am 22.08.2007 19:45:37 von Matt Barbadian
On Aug 22, 10:35 am, "J.O. Aho" wrote:
> mbarbs wrote:
> > On Aug 22, 9:21 am, "J.O. Aho" wrote:
> >>> The problem is i have this for example in
> >>> one of the fields in the mysql database. When the page loads it shows
> >>> the html NOT a clickable link.
> >> The problem is how you store the value to the database, you most likely used
> >> htmlentities() or a simialr function on the string before you stored it, which
> >> makes it to be displayed as it's written and not parsed by the browser as
> >> html-code.
> > How would you recommend the best way to do this?
>
> If you use a form to input the data, you may need to use
> html_entity_decode() to get rid of all htm encoded characters (you don't want
> those)
>
> Before you store data into the database, you want to run addslashes(), this
> prevents problems with " or ' in the strings.
>
> And when you fetched the data from the database, use stripslashes(), before
> you echo things out.
>
> --
>
> //Aho
Thanks Aho. But for right now i'm manually entering the data into
mysql.
Re: href in mysql databse
am 22.08.2007 19:59:33 von Paul Lautman
J.O. Aho wrote:
> mbarbs wrote:
>> On Aug 22, 9:21 am, "J.O. Aho" wrote:
>
>>>> The problem is i have this for example
>>>> href="link.html">Link in one of the fields in the mysql
>>>> database. When the page loads it shows the html
>>>> href="link.html">Link NOT a clickable link.
>>> The problem is how you store the value to the database, you most
>>> likely used htmlentities() or a simialr function on the string
>>> before you stored it, which makes it to be displayed as it's
>>> written and not parsed by the browser as html-code.
>
>> How would you recommend the best way to do this?
>>
>
> If you use a form to input the data, you may need to use
> html_entity_decode() to get rid of all htm encoded characters (you
> don't want those)
>
> Before you store data into the database, you want to run
> addslashes(), this prevents problems with " or ' in the strings.
>
> And when you fetched the data from the database, use stripslashes(),
> before you echo things out.
Forget the stripslashes!
Re: href in mysql databse
am 23.08.2007 20:03:09 von unknown
Post removed (X-No-Archive: yes)