Jump to content

table row link


alienmojo

Recommended Posts

ok im trying to make a table in which every row is a link to a different page

here is my code
[CODE]
mysql_select_db("realestate", $con);


$result = mysql_query($SQL);

echo "<table border='5'>
  <tr>
  <th>Picture</th>
  <th>Address</th>
  <th>Price</th>
  <th>Baths</th>
  <th>Bedrooms</th>
  <th>State</th>
  <th>City</th>
  <th>Square Feet</th>
  <th>County</th>
  <th>Year Built</th>
  <th>Buy or Lease</th>
  </tr>";

while($row = mysql_fetch_array($result))
  {
  $accountnum=$row['accountnum']; 
 
  echo '<a href="descrip.php?accountnum='.$accountnum.'">';

  echo "<tr>";
  echo '<td> <img src="images/'.$row['imagename'].'" width="75" height="75"> </td>';
  echo "<td>" . $row['address'] . "</td>";
  echo "<td>" . $row['price'] . "</td>";
  echo "<td>" . $row['baths'] . "</td>";
  echo "<td>" . $row['bedrooms'] . "</td>";
  echo "<td>" . $row['state'] . "</td>";
  echo "<td>" . $row['city'] . "</td>";
  echo "<td>" . $row['squarefeet'] . "</td>";
  echo "<td>" . $row['county'] . "</td>";
  echo "<td>" . $row['yearbuilt'] . "</td>";
  echo "<td>" . $row['buyorlease'] . "</td>";
  echo "</tr>";
 
  echo "</a>";
 

   
  }

echo "</table>";[/CODE]
Link to comment
Share on other sites

I'm not exactly sure what you are looking for...

[code]
<?php

mysql_select_db("realestate", $con);

$result = mysql_query($SQL);

echo "<table border='5'>
  <tr>
  <th>Picture</th>
  <th>Address</th>
  <th>Price</th>
  <th>Baths</th>
  <th>Bedrooms</th>
  <th>State</th>
  <th>City</th>
  <th>Square Feet</th>
  <th>County</th>
  <th>Year Built</th>
  <th>Buy or Lease</th>
  </tr>";

while($row = mysql_fetch_array($result))
  {
  $accountnum=$row['accountnum']; 
 
  echo '<a href="descrip.php?accountnum='.$accountnum.'">';

  echo "<tr>";
  echo '<td> <img src="images/'.$row['imagename'].'" width="75" height="75"> </td>';
  echo "<td><a href='link.php'>" . $row['address'] . "</a></td>";
  echo "<td><a href='link.php'>" . $row['price'] . "</a></td>";
  echo "<td><a href='link.php'>" . $row['baths'] . "</a></td>";
  echo "<td><a href='link.php'>" . $row['bedrooms'] . "</a></td>";
  echo "<td><a href='link.php'>" . $row['state'] . "</a></td>";
  echo "<td><a href='link.php'>" . $row['city'] . "</a></td>";
  echo "<td><a href='link.php'>" . $row['squarefeet'] . "</a></td>";
  echo "<td><a href='link.php'>" . $row['county'] . "</a></td>";
  echo "<td><a href='link.php'>" . $row['yearbuilt'] . "</a></td>";
  echo "<td><a href='link.php'>" . $row['buyorlease'] . "</a></td>";
  echo "</tr>";
 
  echo "</a>";
 

   
  }

echo "</table>";
?>


[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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