Jump to content

[SOLVED] create a link from information in a mysql database


drkshenronx

Recommended Posts

First and foremost I am a total newb to php and mysql, so please bear with me!!

Heres my problem, I want to add websites into a mysql database by their name and website url. I want the url to be a link when it is displayed on the page instead of just plain text. Heres the snippet of code that I am using to display information from the database query.

 

if(mysql_num_rows($result) == 0){

        echo("Nothing to Display!");

    }

 

    $bgcolor = "#E0E0E0";

 

    echo("<table>");

   

    while($row = mysql_fetch_array($result)){

        if ($bgcolor == "#E0E0E0"){

            $bgcolor = "#FFFFFF";

        }else{

            $bgcolor = "#E0E0E0";

        }

 

    echo("<tr bgcolor=".$bgcolor."><td>");

    echo($row["page_name"]);

    echo("</td><td>");

    echo($row["website_url"]);

    echo("</td></tr>");

    }

 

    echo("</table>");

 

 

Here is my output

 

 

Name of website 1

            somewebsite.com

Name of website 2

            somewebsite2.com

Name of website 3

            somewebsite3.com

 

 

 

The following line is the one I need help modifying

 

echo($row["website_url"]);

 

I want to change it so that the website url is displayed as a link instead of just plain text. Can anyone help me with this?

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.