Jump to content


Photo

Displaying URL field from database causes duplicate link ... why?


  • Please log in to reply
1 reply to this topic

#1 simcoweb

simcoweb
  • Members
  • PipPipPip
  • Advanced Member
  • 1,102 posts
  • LocationCA

Posted 27 September 2006 - 04:13 PM

I'm extracting a field from a MySQL database to display in a page as a hyperlink. The field contains a url like www.yoursite.com and i'm using this code to display it in an 'echo' statement containing  a large amount of HTML. Here's how the field is displayed:

<b>•</b> <a class="body" href="$url">Click Here To Visit My Site</a>

The page displays it just fine as a hyperlink. But, the problem is when you mouse over it I get a duplicate URL like this:

http://www.yoursite.com/www.yoursite.com


Which makes it appear as though it's treating the field data as a 'relative' link instead of just inserting it as it should. Ideas?

#2 simcoweb

simcoweb
  • Members
  • PipPipPip
  • Advanced Member
  • 1,102 posts
  • LocationCA

Posted 27 September 2006 - 04:15 PM

heh.. never mind :)

I answered my own question. The problem was that the entries in the database didn't include http:// and were just www.yoursite.com. I updated that field to include the http:// and now they work properly.

Just an FYI for any others who want to include URL's into their pages :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users