Jump to content

[SOLVED] PHP/MySQL: showing a URL


kirkfitz

Recommended Posts

 

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

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 />";
      }
    }
  }

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.