justin7410 Posted January 19, 2014 Share Posted January 19, 2014 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 Quote Link to comment Share on other sites More sharing options...
davidannis Posted January 19, 2014 Share Posted January 19, 2014 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. Quote Link to comment Share on other sites More sharing options...
Solution justin7410 Posted January 19, 2014 Author Solution Share Posted January 19, 2014 The issue was actually that the database field or data i was inserting did not contain http:// at the beginning of the source so the anchor tag was just searching for the directory. but thanks for the feedback , still much appreciated. Quote Link to comment Share on other sites More sharing options...
davidannis Posted January 20, 2014 Share Posted January 20, 2014 In that case the link generated would have been to: www.mywebsite.com/ExampleLinkDontClick.com not to: www.mywebsite.com/http://ExampleLinkDontClick.com as in your original post. Be careful when you post and use cut and paste. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.