htmanning has asked for the wisdom of the Perl Monks concerning the following question:
I am looping through, but I can't figure out how to NOT print the date again if it has already been printed. I have something like the following (this is not the actual code):2020-03-21 | 2:00 pm | 3:00 pm 2020-03-22 | 2:00:pm
$SQL = "SELECT * from $reservations_table where approved!='declined' a +nd date > '$dateadded2' OR (date = '$dateadded2' and militaryendtime +> '$hourmin' and approved!='declined' and approved!='cancelled') orde +r by date asc, militarytime asc"; &Do_SQL; $startcount = ($currentpage - 1) * $titlesperpage + 1; $stopcount = $currentpage * $titlesperpage; $current_count = 0; while (($pointer = $sth->fetchrow_hashref) && ($current_count +<= $stopcount)){ $current_count++; if ($current_count >= $startcount && $current_count <= $st +opcount) { print <<HTML; <table border=0 cellpadding=5 cellspacing=5> <tr> <td width=100 align=center><b>$date</b></td> <td width=100 align=center>$time_lc</td> <td>-</td> <td width=100 align=center>$endtime_lc</td> <td width=100 align=center>$area</td> <td width=100 align=center>$unit</td> </tr> </table> } }
I tried to set a $lastdate = $date after the loop, then compare it on the next loop but I'm doing something wrong. Any ideas? Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching Dates
by choroba (Cardinal) on Mar 22, 2020 at 02:26 UTC | |
by Aldebaran (Curate) on Mar 24, 2020 at 02:19 UTC |