Question

Comment mettre la liste pendant la boucle?

PHP:

> $q = $db->query("SELECT * FROM
> bs_events LEFT JOIN bs_reservations ON
> bs_reservations.id_event = bs_events.id   
> GROUP BY bs_reservations.id_event 
> ORDER BY bs_events.eventDate ASC LIMIT 20");

Tableau HTML:

> while($r = $q->fetch_array(MYSQLI_ASSOC)):  
> echo '<tr>';
> echo '<td>' . $r['title'] . '</td>';  
> echo '<td>' . date('d/M/Y', strtotime($r['eventDate'])) . ' / ' . $r['eventTime'] . '</td>';  
> echo '<td>' . $r['location'] . '</td>';  
> echo '<td>' . array($r['username']) .'</td>';  
> echo '<td ></td>';  
> echo '<td ></td>';  
> echo '</tr>';  
> endwhile;

Le code ci-dessus sortira

TITLE        DATE/TIME      LOCATION    USERNAME
=================================================
1       dd/mm/yyy / hh:mm   location    username
1       dd/mm/yyy / hh:mm   location    username1 
1       dd/mm/yyy / hh:mm   location    username2 
2       dd/mm/yyy / hh:mm   location    username   

Et je veux la sortie

TITLE        DATE/TIME      LOCATION    USERNAME
=================================================
1       dd/mm/yyy / hh:mm   location    username, username1, username2  
2       dd/mm/yyy / hh:mm   location    username 

ou ai-je besoin de mettre en place echo '<td>' . array($r['username']) .'</td>';

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top