0
I’m having trouble grouping times by date.
I have an html table that is populated from an sql query. The idea would be to list in one column the date and in the other column all times referring to that date without having to skip line as in the photo I posted at the end. What could be done?
Code:
<table class="table table-striped">
<thead>
<tr>
<th>Data</th>
<th>Marcações</th>
</tr>
</thead>
<?php
$con = mysql_connect($host, $user, $pass) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($db, $con);
$sql= mysql_query("SELECT dia, hora FROM marcacoes");
while($exibe = mysql_fetch_assoc($sql)){
$tabela ='<tbody>';
$tabela .='<tr>';
$tabela .='<td>'.date("d-m-Y", strtotime($exibe['dia'])).'</td>';
$tabela .='<td>'.$exibe['hora'].'</td>';
$tabela .='</tr>';
$tabela .='</tbody>';
echo $tabela;
}
?>
Dude worked out!! Right there in case I display this consultation?
– Smoke Rohden
To display is a normal query, you must name GROUP_CONCAT with some alias to facilitate recovery of values. I will edit my reply with an example.
– Bruno Bermann
Perfect!! Thanks Bruno for the answer helped me a lot!
– Smoke Rohden