I am having an issue where I create a loop of headings. I want to create a list of dates for each heading, these dates are pulled from MySQL as are the headings.
I think I am looking to loop within an loop.
I think once $h reaches $number_of_days it doesn’t reset even though it is within the 1st while loop. Is there a different way to go about this?
$h='1';
while($report_types = $rt_type->fetch())
{
$rt_types = $report_types['report_name'];
echo '<div>'. $rt_types .'</div>';
while($h <= $number_of_days){
echo '<div class="report_day">'.$h.'</div>';
$h++;
}
}
while($h <= $number_of_days){where did you initialize $h?$h='1';should be$h=1;to make it an integer.<=will do a loose comparison casting$h, and then$h++will cast to an integer.for($h=1;$h<=$number_of_days;$h++) {will end all$hissues.