Jump to content

<a href=""> link not going to proper URL when coming from DB


justin7410
Go to solution Solved by justin7410,

Recommended Posts

Hey Guys,

 

So i have a while loop bringing back some information for me from my database.

 

pretty basic:

$query = 'SELECT * from `db` WHERE `id` = '. $id;
$run = mysql_query($query);
while($rows = mysql_fetch_assoc($run)){

extract($rows);



}
 

Now in this loop i am trying to add a link using an anchor tag:

echo '<a href="'.$domain . '">'.$domain.'</a><br>'; ( I WILL USE EXAMPLE LINK DONT CLICK BELOW FOR DEMO PURPOSES)
which basically makes something like :  http://ExampleLinkDontClick.com

 

Now my issue is that for the life of me i cant understand why my link is being given and shown correctly, but the link is firing as

 

www.mywebsite.com/http://ExampleLinkDontClick.com

 

 

so as you can see the anchor tag is looking for a page that i created or is on file in the directory, instead of going to the designated source of the url.

 

any suggestions ? am i just missing something very basic ?

 

usually this works flawlessly but maybe today is just one of those days .. lol

 

thanks guys

 

-justin7410

Link to comment
Share on other sites

Do a view source on the link you create in your browser. My guess is that there is a . is inside the quotes like this:

echo '<a href=".'.$domain . '">'.$domain.'</a><br>'; ( I WILL USE EXAMPLE LINK DONT CLICK BELOW FOR DEMO PURPOSES)

or some other typo. Please cut and paste the php that creates the link and an actual link if you can't find it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.