mysql - How to bundle PHP rows into collapsible form? (Elemental access to multidimensional array using next()) -
i've got this:
while( $row = $result->fetch_assoc() ) { switch ($row["card_id"]) { case 0: include 'card_0.php'; break; case 1: include 'card_1.php'; break; case 2: include 'card_2.php'; break; case 3: include 'card_3.php'; break; } }
in case card_id
1
want detect whether next row's card_id same, , whether next next row's card_id same , on until have them , put associated field elements unordered list---as bootstrap collapsible object. whole idea here don't want card_1
events stacked right on top of each other. want them collapsible. so, since events ordered date they'll this:
card_0 card_1 card_1 card_1 card_3 card_2 card_2 card_1 card_1 card_1 card_1
i want instead:
card_0 card_1<--clickable collapsible card_3 card_2 card_2 card_1<--clickable collapsible
i thinking this:
while( $i == true ) { while( current($row["card_id"]) == next($row["card_id"]) ) { $pea_pod[] = $row["field"]; } $i = false; }
would work?
i've done before, neat trick used use card item in arrays id ie:
array[card_1][$i]
then count array[card_1]
edit:
not $i use default:
array[card_1][]
Comments
Post a Comment