In a nutshell: I'm having issues trying to create a proper filter using the value from the first recordset in the second recordset.
Overview: I have 3 tables (LINES; SERIES; FIGURES). Figures are a child of Series and Series is a child of Lines. I want a detail page with a selected Lines details, a table for each series within the line and in each series table, repeating rows of all the figures within that series.
Here are two sets of code from previous tries: Both sets of code have the second recordset within the repeat loop. This is the code within that loop.
The first set of code will repeat the tables AND repeat the rows however the results for the rows show all figures within the line rather than filtering them for the series: You can see the result at this link: BTW, I had to hard code the Where statement to get a result to show. It's this Where statement that I think is my issue. http://www.onlinetoyshow.com/admin/lines/figure_lines_Detail.php?Line_Id=1
<?php do { ?>
<table width="400px" border="1" cellspacing="0" cellpadding="3">
<tr>
<td><img src="../../images/series_thumb/<?php echo $row_WADAfigure_lines['Series_thumbnail']; ?>" alt="" name="Series_Thumbnail" id="Series_Thumbnail" width="50" height="50" /></td>
<td><?php echo $row_WADAfigure_lines['Series_Name']; ?></td>
<td align="right" nowrap="nowrap" ><a href="../series/series_Detail.php?Series_Id=<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" title="View"><img border="0" name="View<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" id="View<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" alt="View" src="../../WA_DataAssist/images/Pacifica/Traditional_zoom.gif" /></a><a href="../series/series_Update.php?Series_Id=<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" title="Update"><img border="0" name="Update<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" id="Update<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" alt="Update" src="../../WA_DataAssist/images/Pacifica/Traditional_edit.gif" /></a></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<?php
mysql_select_db($database_FIGURES, $FIGURES);
$query_rsFigures = "SELECT Figure_Name, Figure_Thumbnail, series.Series_Id FROM figures INNER JOIN series ON figures.Series_Id = series.Series_Id WHERE series.Series_Id = 13 ORDER BY Figure_Name ASC";
$rsFigures = mysql_query($query_rsFigures, $FIGURES) or die(mysql_error());
$row_rsFigures = mysql_fetch_assoc($rsFigures);
$totalRows_rsFigures = mysql_num_rows($rsFigures);
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_rsFigures){
?>
<tr>
<td><center><img src="../../images/figure_thumb/<?php echo $row_rsFigures['Figure_Thumbnail']; ?>" alt="" name="Figure_Thumbnail" id="Figure_Thumbnail" width="40" height="40" /></center></td>
<td><?php echo $row_rsFigures['Figure_Name']; ?></td>
<td align="right"><a href="#">Links</a></td>
</tr>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_rsFigures && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rsFigures = mysql_fetch_assoc($rsFigures);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
</table>
<br />
<?php } while ($row_WADAfigure_lines = mysql_fetch_assoc($WADAfigure_lines)); ?>
This is another try where I tried the runtime value of the first recordset but this does not return any row value at all for the second recordset. If you were to see this in the browser it would only show three tables with the 3 separate series tables but 3 blank 2nd rows where the repeating figures should be.
<?php
$_POST['WADAfigure_lines_series.Series_Id'] = $row_WADAfigure_lines['series.Series_Id'];
$ParamSeriesID_rsFigures = "-1";
if (isset($_POST['WADAfigure_lines_series.Series_Id'])) {
$ParamSeriesID_rsFigures = (get_magic_quotes_gpc()) ? $_POST['WADAfigure_lines_series.Series_Id'] : addslashes($_POST['WADAfigure_lines_series.Series_Id']);
}
mysql_select_db($database_FIGURES, $FIGURES);
$query_rsFigures = sprintf("SELECT Figure_Name, Figure_Thumbnail, series.Series_Id FROM figures INNER JOIN series ON figures.Series_Id = series.Series_Id WHERE series.Series_Id = %s ORDER BY Figure_Name ASC", GetSQLValueString($ParamSeriesID_rsFigures, "int"));
$rsFigures = mysql_query($query_rsFigures, $FIGURES) or die(mysql_error());
$row_rsFigures = mysql_fetch_assoc($rsFigures);
$totalRows_rsFigures = mysql_num_rows($rsFigures);
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_rsFigures){
?>
<tr>
<td><center><img src="../../images/figure_thumb/<?php echo $row_rsFigures['Figure_Thumbnail']; ?>" alt="" name="Figure_Thumbnail" id="Figure_Thumbnail" width="40" height="40" /></center></td>
<td><?php echo $row_rsFigures['Figure_Name']; ?></td>
<td align="right"><a href="#">Links</a></td>
</tr>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_rsFigures && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rsFigures = mysql_fetch_assoc($rsFigures);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
</table>
<br />
<?php } while ($row_WADAfigure_lines = mysql_fetch_assoc($WADAfigure_lines)); ?>
All help is appreciated. I can provide files as needed.