Inside the outer loop you need to define the parameters for the internal recordset to come from the main recordset. So instead of:
<?php
$yearparam_rsVideo = "-1";
if (isset($_GET['DateAdd'])) {
$yearparam_rsVideo = $_GET['DateAdd'];
}
$monthparam_rsVideo = "-1";
if (isset($_GET['DateAdd'])) {
$monthparam_rsVideo = $_GET['DateAdd'];
}
mysql_select_db($database_connBLUR, $connBLUR);
$query_rsVideo = sprintf("SELECT vdID, DateAdd, vidcateID, Title, Photo, Display FROM VideoDictionary WHERE Display = 1 AND YEAR(DateAdd) = %s AND MONTH(DateAdd) = %s ORDER BY DateAdd Desc", GetSQLValueString($yearparam_rsVideo, "int"),GetSQLValueString($monthparam_rsVideo, "int"));
$rsVideo = mysql_query($query_rsVideo, $connBLUR) or die(mysql_error());
$row_rsVideo = mysql_fetch_assoc($rsVideo);
$totalRows_rsVideo = mysql_num_rows($rsVideo);
?>
<?php
$_GET['DateAdd'] = $row_rsMonths['DateAdd'];
?>
you would use:
<?php
$_GET['yearAdd'] = $row_rsMonths['year'];
$_GET['monthAdd'] = $row_rsMonths['month'];
?>
<?php
$yearparam_rsVideo = "-1";
if (isset($_GET['yearAdd'])) {
$yearparam_rsVideo = $_GET['yearAdd'];
}
$monthparam_rsVideo = "-1";
if (isset($_GET['monthAdd'])) {
$monthparam_rsVideo = $_GET['monthAdd'];
}
mysql_select_db($database_connBLUR, $connBLUR);
$query_rsVideo = sprintf("SELECT vdID, DateAdd, vidcateID, Title, Photo, Display FROM VideoDictionary WHERE Display = 1 AND YEAR(DateAdd) = %s AND MONTH(DateAdd) = %s ORDER BY DateAdd Desc", GetSQLValueString($yearparam_rsVideo, "int"),GetSQLValueString($monthparam_rsVideo, "int"));
$rsVideo = mysql_query($query_rsVideo, $connBLUR) or die(mysql_error());
$row_rsVideo = mysql_fetch_assoc($rsVideo);
$totalRows_rsVideo = mysql_num_rows($rsVideo);
?>