Jump to content

html links from mysql database


daniellynn2000

Recommended Posts

Yes. Something like...

 

<?php

  $sql = "SELECT link, address FROM links";
  if ($result = mysql_query($sql)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_assoc($result)) {
        echo "<a href='{$row['address']}'>{$row['link']}</a><br />";
      }
    }
  }

?>

Or if your looking for something specific you can do something like this.

mysql_select_db("Your DB") or die(mysql_error());
$query = "SELECT * FROM YourTable WHERE WhatEver ="TheThingYourLookingFor";		
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
echo '<a href='.$row['Your Link'].' ">.'$row['HowYouWantToDescribeIt'].'</a>';

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.