Jump to content

Uhm.. div tags in loop out of order?


Branden Wagner

Recommended Posts

Ok so basically its supposed to out put like this
[url=http://dev.pureintellect.com/status/index.html]http://dev.pureintellect.com/status/index.html[/url]
i cant get the tags right... can someone help me?
i was trying to figure out how i could look ahead in the loop.
and add something like
if($day != $next_day)
{
    //close issues list
    echo "</div>";
    //close the day
    echo "</div>";
}
[code]
        function getAll($resolved)
        {
                $query = "SELECT id,note,author,UNIX_TIMESTAMP(date) as date FROM status where resolved =$resolved ORDER BY date DESC
                $result = db::query($query);
                $last_day = null;
                while($row = db::fetch_assoc($result))
                {
                        $date = $row['date'];
                        list($day,$time) = split(" ",date("m/j/Y g:i:s", $date));
                        $note = $row['note'];
                        $author = $row['author'];

                        if($day != $last_day)
                        {
                                echo "<div class=\"day\">";
                                echo "<div class=\"heading\">$day</div>";
                                echo "<div class=\"issues\">";
                                echo "  <div class=\"issue\">";
                                echo "          <div class=\"date\">$day $time</div>";
                                echo "          <div class=\"note\">$note</div>";
                                echo "          <div class=\"author\">$author</div>";
                                echo "  </div>";
                        }
                        if($day == $last_day)
                        {
                                echo "  <div class=\"issue\">";
                                echo "          <div class=\"date\">$day $time</div>";
                                echo "          <div class=\"note\">$note</div>";
                                echo "          <div class=\"author\">$author</div>";
                                echo "  </div>";
                        }
                        echo "</div>"; // closes issues div
                        echo "</div>"; // closes day
                        echo "<br />"; 
                        $last_day = $day;
                }                 
                $status =array($issues,$times,$notes,$authors);
                return $status;
        }
[/code]
my original goal was to put everything into an array, that way i could do counts on it later to find out how many "open tickets" were there each day.
any help at all would be great.. even if that means you think i should rewrite it in some other way.
Link to comment
https://forums.phpfreaks.com/topic/27795-uhm-div-tags-in-loop-out-of-order/
Share on other sites

OK.....since no one knows how to help... does anyone know how to look ahead in the query??

while($row = db::fetch_assoc($result))
{
    $date = $row['date'];

}
that will get me the date of the current row...  how can i get the date of the next row? without continuing to the next iteration of the loop.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.