kirkfitz Posted April 3, 2007 Share Posted April 3, 2007 I am very new to using mysql and learning php. I need a little direction on where to look for my answer to a question. Is it possible to store a URL in a mysql table and then have it display on a webpage in a table that then it can be clicked on and taken to the URL? I have learned how to make the information show in a table as text, but not as a hyperlink. I can get it to show as a link to the root directory of my website. Any help on where to look or what code to use would be so helpful. Thank you.. Link to comment https://forums.phpfreaks.com/topic/45478-solved-phpmysql-showing-a-url/ Share on other sites More sharing options...
per1os Posted April 3, 2007 Share Posted April 3, 2007 <a href="url from databasehere">Title of URL here</a> Simple html man, I would HIGHLY recommend learning that before venturing too deep into php and mysql. www.webmonkey.com has a pretty good html tutorial. Link to comment https://forums.phpfreaks.com/topic/45478-solved-phpmysql-showing-a-url/#findComment-220817 Share on other sites More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 A simple example. <?php // connect if ($result = mysql_query("SELECT title,url FROM links")) { if (mysql_num_rows($result)) { while($row = mysql_fetch_assoc($result)) { echo "<a href='{$row['url']}'>{$row['title']}</a><br />"; } } } ?> Link to comment https://forums.phpfreaks.com/topic/45478-solved-phpmysql-showing-a-url/#findComment-220820 Share on other sites More sharing options...
kirkfitz Posted April 3, 2007 Author Share Posted April 3, 2007 Thanks so much thorpe thorpe! Worked perfectly. I can find plenty of help on a lot of the more intermediate skilled tasks, but not something so basic! Link to comment https://forums.phpfreaks.com/topic/45478-solved-phpmysql-showing-a-url/#findComment-220826 Share on other sites More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 All you need remember is that PHP just outputs strings. Its up to you to format those strings appropriately. Most of the time, it'll be simple html. Link to comment https://forums.phpfreaks.com/topic/45478-solved-phpmysql-showing-a-url/#findComment-220828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.