Dynamically created tables

I have code below that creates HTML tables on the fly to display Tables from an Antique website. As I loop through each item I want to store
a link to a more information page (yellow) where a customer can see additional views of each piece where each individual piece would have it’s
own page.
The image name is stored in the field
$row[‘frnimageclick’]. If I have a detail page for each item called name +
“detailpage.htm”, how to I concatinate name with
“detailpage.htm”, store it in a variable, and the insert it into the a href
link below (yellow)?
thanks for any input


   <?php

// Make a MySQL Connection
mysql_connect("localhost", "chuck", "**********") or die(mysql_error());
mysql_select_db("chuck_main") or die(mysql_error());


// Retrieve all tables
//$result = mysql_query("SELECT frndescshort, envyear, frnimageclick, frnstyle FROM inventory WHERE frnsubtype = 'drlf' OR frnsubtype = 'stds'") or die(mysql_error());  
// Testing all inventory in tables
$result = mysql_query("SELECT frndescshort, envyear, frnimageclick, frnstyle FROM inventory") or die(mysql_error());  


//Save for adding the HTML & and CSS
$num = @mysql_num_rows($result); 
 // you choose how many columns you want to display in each table row
$cols=2;		// Here we define the number of columns

//testing the layout
//echo "<table border='4' bordercolor='green' align = 'center'>";	// The container table with $cols columns
echo "<table border='1'>";
// Outer loop creating rows
do{

  //Start a new row
  echo "<tr>";
  //testing
  //echo "<td> Outer table </td>";
  // inner loop creating columns
  for($r=1;$r<=$cols;$r++) {
    // echo the actual data to the screen   
    $row = mysql_fetch_array( $result );
    if($row){
      echo "<td>";
         //testing the layout
          echo "<table border='1'>";
          //echo "<table border='0'>";
          echo '<tr valign="top">';
             // Images should all be the same size to display properly
             // For testing point to images when retrieving all inventory
             //echo "<td width='250px' height='250px'><img src='images/AntiquePics/Tables/".$row['frnimageclick']."' />'</td>";
             echo "<td width='250px' height='200px'><img src='images/".$row['frnimageclick']."' />'</td>";
             echo "<td width='250px' height='200px'>";
               echo "Period/Date : ".$row['envyear'];
               echo "<br />";
               echo "Style       : ".$row['frnstyle'];
               echo "<br />";
               echo "Description :".$row['frndescshort'];
                // to display only the field
               // echo $row['frndescshort'];
                echo "<br />";
               [COLOR="Yellow"]echo '<a href="menu-item-3.htm">More Information</a>&nbsp;&nbsp;<strong font style="color: #ffffff;">.</strong>&nbsp;&nbsp';[/COLOR]              echo "<br />";
               echo "</td>";
              // echo '<td width="50">&nbsp;</td>';	
          echo  "</tr>";
        echo "</table>";
      echo "</td>";
    }
    else{
     // echo "<td>&nbsp;</td>";	//If there are no more records at the end, add a blank column
    }
  }
  echo "</tr>";
} while($row);
echo "</table>";	

?>

So… the name is being stored as…? $row[‘name’]?


echo '<a href="'.$row['name'].'detailpage.htm">More Information</a> ....'

Yes the name of the image is stored in the field $row[‘frnimageclick’]. I thought if I added a detail page for each item, a good naming convention
would be “name of image”:detailpage.htm. thanks

Well if you’re going to use a database to dynamically create the tables, why not have a page that dynamically presents the details?

I’m eventually going to try to do that but want to get just the bare minimum working
first.

If I wanted to create the detail page dynamically, how would I do it? I still would have
to have the additional views for each item already stored in the Database.

btw; do us a favor, go and edit your original post and erase your database password from it :wink:

I’m not sure how to edit my initial posting

Is there not an edit button on the bottom left of the post?

[ot]

Done. :)[/ot]

thanks!