First off, a very helpful forum! I have searched and searched for my answer, and came soooo close, but not quite there, yet.
I am putting together a band listing.
(REGISTRATION FORM) Users can upload information, including a photo, mp3 file, and the usual address text and the like. No problem so far, everything works and the data is accessible.
(LISTING PAGE) Here the data is retrieved and is formatted in a dynamic table (DW mx). There are four fields shown on this page:
"genre", "image", "band", "entry"
"genre" is easy and it just needs to appear.
"image" can be clicked on and a larger image appears in a _blank window
"entry" can be clicked on and the user can hear the music
All of the above is working okay.
"band" is my problem, and I don't know if it's because it is in a table or not. I want this to show up in my table as a link. The link would take me to a new page (biotest02.php), which is a band bio page. Right now in my sample DB there are four records. In the table generated by the code below, all four band entries shown up in each of the band cells. So instead of seeing an individual entry in each cell, all four appear.
<?php require_once('Connections/BB2.php'); ?>
<?php
$maxRows_trashbb2sample = 10;
$pageNum_trashbb2sample = 0;
if (isset($HTTP_GET_VARS['pageNum_trashbb2sample'])) {
$pageNum_trashbb2sample = $HTTP_GET_VARS['pageNum_trashbb2sample'];
}
$startRow_trashbb2sample = $pageNum_trashbb2sample * $maxRows_trashbb2sample;
mysql_select_db($database_BB2, $BB2);
$query_trashbb2sample = "SELECT bb2.genre, bb2.image, bb2.band, bb2.bio, bb2.entry, bb2.id FROM bb2";
$query_limit_trashbb2sample = sprintf("%s LIMIT %d, %d", $query_trashbb2sample, $startRow_trashbb2sample, $maxRows_trashbb2sample);
$trashbb2sample = mysql_query($query_limit_trashbb2sample, $BB2) or die(mysql_error());
$row_trashbb2sample = mysql_fetch_assoc($trashbb2sample);
if (isset($HTTP_GET_VARS['totalRows_trashbb2sample'])) {
$totalRows_trashbb2sample = $HTTP_GET_VARS['totalRows_trashbb2sample'];
} else {
$all_trashbb2sample = mysql_query($query_trashbb2sample);
$totalRows_trashbb2sample = mysql_num_rows($all_trashbb2sample);
}
$totalPages_trashbb2sample = ceil($totalRows_trashbb2sample/$maxRows_trashbb2sample)-1;
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><body>
<table width="790" border="1" cellpadding="1" cellspacing="1">
<tr bgcolor="#000000">
<td > <div align="center"><font size="-1"><strong><font color="#FFFFFF">Genre</font></strong></font></div></td>
<td > <div align="center"><font size="-1"><strong><font color="#FFFFFF">Photo</font></strong></font></div></td>
<td > <div align="center"><font size="-1"><strong><font color="#FFFFFF">Mp3</font></strong></font></div></td>
<td > <div align="center"><font size="-1"><strong><font color="#FFFFFF">Band
Name </font></strong></font></div></td>
</tr>
<?php do { ?>
<tr>
<td >
<div align="center"><?php echo $row_trashbb2sample['genre']; ?></div></td>
<td >
<div align="center"><a href="<?php echo $row_trashbb2sample['image']; ?>" target="_blank"><img src="<?php echo $row_trashbb2sample['image']; ?>" width="50" height="50" border="0"></a></div></td>
<td >
<div align="center"><a href="<?php echo $row_trashbb2sample['entry']; ?>">listen</a></div></td>
<td >
<div align="left"> <?php
$results = @mysql_query($query_trashbb2sample)
or die('MySQL error: ' . mysql_error() . '<br>Query: ' . $query_trashbb2sample);
while ( $row= mysql_fetch_array($results)) {
echo('<ul><a href="biotest02.php?id=' . $row['id'] . '">'.$row['band'].'</a></ul>'); } ?></div></td>
</tr>
<?php } while ($row_trashbb2sample = mysql_fetch_assoc($trashbb2sample)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($trashbb2sample);
?>
On the band bio page (biotest02.php) I need these fields:
"band", "bio", "image", "entry"
for the band id that was just clicked on.
Make sense? In short, click on a band name and the band bio page comes up with that bands' information.