Add link to table matrix
Posted: Fri Nov 14, 2008 11:53 pm
This code creates, basically a matrix of data. I found it here. It displays pictures and caption(s) and works great. I'm trying to add a link and can't get it to work of course. I'm real new at php.. and all internet programming.. and becomming addicted. Thanks -Scott
<?php
$retid = mysql_query($query_Recordset1, $SQLConnect) or die(mysql_error());
# display results
$output .= "<P><DT><B>$category</B><BR>\n\n";
$output .= "<table>\n\n";
$howmany = mysql_num_rows($retid);
$rowmax = 5;
for($x = 0; $row = mysql_fetch_array($retid); $x++)
{
if($x % $rowmax == 0)
$output .= "<tr>\n";
$id = $row["id"];
$username = $row["username"]; // <?php echo substr_replace($row_Recordset1['image_front'],'thumb_',6,0);
$name = $row["name"];
$image_front = substr_replace($row['image_front'],'thumb_',6,0);
$image_back = $row["image_back"];
$material = $row["material"];
//$photographer = $row["username"];
$output .= "<td><img src =\"$image_front\"><br>$name $material </td>"; // this works
$output .= "<td><a href="blowup.php?recordID=<?php echo $row['id']?><img src =\"$image_front\"><br>$name $material </a></td>"; // this does not work
if($x % $rowmax == $rowmax - 1)
$output .= "\r</tr>\n\n";
}
if($left = (($howmany + $rowmax - 1) % $rowmax))
$output .= '<td colspan="' . $left . '"> ' . ";</td>\n</tr>\n\n";
$output .= "</table>\n\n";
$output .= "</DT></P>";
$output .= '</BODY>
</HTML>';
echo $output;
?>
<?php
$retid = mysql_query($query_Recordset1, $SQLConnect) or die(mysql_error());
# display results
$output .= "<P><DT><B>$category</B><BR>\n\n";
$output .= "<table>\n\n";
$howmany = mysql_num_rows($retid);
$rowmax = 5;
for($x = 0; $row = mysql_fetch_array($retid); $x++)
{
if($x % $rowmax == 0)
$output .= "<tr>\n";
$id = $row["id"];
$username = $row["username"]; // <?php echo substr_replace($row_Recordset1['image_front'],'thumb_',6,0);
$name = $row["name"];
$image_front = substr_replace($row['image_front'],'thumb_',6,0);
$image_back = $row["image_back"];
$material = $row["material"];
//$photographer = $row["username"];
$output .= "<td><img src =\"$image_front\"><br>$name $material </td>"; // this works
$output .= "<td><a href="blowup.php?recordID=<?php echo $row['id']?><img src =\"$image_front\"><br>$name $material </a></td>"; // this does not work
if($x % $rowmax == $rowmax - 1)
$output .= "\r</tr>\n\n";
}
if($left = (($howmany + $rowmax - 1) % $rowmax))
$output .= '<td colspan="' . $left . '"> ' . ";</td>\n</tr>\n\n";
$output .= "</table>\n\n";
$output .= "</DT></P>";
$output .= '</BODY>
</HTML>';
echo $output;
?>