#1
  1. No Profile Picture
    g_kas
    Guest
    Devshed Newbie (0 - 499 posts)
    I'm trying to insert a link into a table that is generated through a MySQL Query.

    Here's the code:

    <?
    error_reporting(0);
    include "auth.php";
    MySQLConnect("Error Connecting",
    "Temporarely unavailable.");

    $result = MySQLQuery("select * from bizfile order by name",
    "Error Selecting",
    "Temporarely unavailable.");

    // create header row
    print("<tr>n");
    print("<td><b>Name</b></td>n");
    print("<td><b>City</b></td>n");
    print("<td><b>Type</b></td>n");
    print("</tr>n");


    // get each row
    while($row=mysql_fetch_array($result))
    {
    $id=$row[0];
    $name=$row[1];
    $city=$row[2];
    $type=$row[3];

    print("<tr>n");

    print("<td>$name</td>n");
    print("<td>$city</td>n");
    print("<td>$type</td>n");

    print("<tr>n");
    }
    ?>

    What I'd like is a link at the end of each table row which would load a page with information relevant to that database row. For example, if the main table lists business establishments, the link would set-up a page which includes the businesses address as well as relevant financial information.

    I tried inserting into the prints the following line:

    print("<td><a href="$id.htm"> Test </a></td>n");

    but.... didn't work

    Can anyone help???

    Thanks in advance....
  2. #2
  3. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    Change this line:

    print("<td><a href="$id.htm"> Test </a></td>n");

    to:

    print("<td><a href="$id.htm"> Test </a></td>n");
  4. #3
  5. No Profile Picture
    jcommand
    Guest
    Devshed Newbie (0 - 499 posts)
    If the last method didn't work, change:

    print("<td><a href="$id.htm"> Test </a></td>n");

    to:

    print("<td><a href="" . $id . ".htm"> Test </a></td>n");

Similar Threads

  1. hover link color only when in table?
    By Dakinesoul in forum HTML Programming
    Replies: 2
    Last Post: February 13th, 2004, 06:05 PM
  2. Problem: Displaying image link inside table from MySQL
    By Shadowz in forum PHP Development
    Replies: 4
    Last Post: February 13th, 2004, 01:37 AM
  3. Inserting multiple rows to mysql table
    By Roaddust in forum PHP Development
    Replies: 6
    Last Post: February 4th, 2004, 08:28 AM
  4. PHP + MySQL query to make a link
    By emp/ir:kal in forum PHP Development
    Replies: 6
    Last Post: January 22nd, 2004, 12:10 PM
  5. how to keep table on top, not centered??
    By vinyl in forum HTML Programming
    Replies: 2
    Last Post: January 20th, 2004, 06:19 PM

IMN logo majestic logo threadwatch logo seochat tools logo