0
I have a table with the columns attendant, total/day and total/month.
I listed on tr/td the names of people through the first MYSQL query. I need through the second query to sum up the records of these people and print on the next td. The problem is that the queries are from different tables and do not know how to print inside a tr through the While query values from different MYSQL tables.
$nome = $_SESSION['usuarioNome'];
$nomes = mysql_query("SELECT nome FROM usuarios"); //primeira consulta
$consulta = mysql_query("SELECT COUNT(*) FROM atendimento WHERE nome = '$nome' AND DAY(data)=DAY(NOW())"); // segunda consulta
Follows HTML:
<table style="text-align: center;width: 100%;" class="table table-striped table-bordered" id="table_id">
<thead>
<tr style="background-color: #007bff;">
<td style="width: 5%;color: white;font-size: 16px;">Atendente:</td>
<td style="width: 4%;color: white;font-size: 16px;">Total/Dia:</td>
<td style="width: 4%;color: white;font-size: 16px;">Total/Mês:</td>
</tr>
</thead>
<tbody>
<?php while($prod = mysql_fetch_array($nomes)) { ?>
<tr data-id="<?php echo $prod['id'] ?>">
<td style="width: 5%;color: black;font-size: 16px;"><?php echo $prod['nome'] ?></td>
<td style="width: 5%;color: black;font-size: 16px;"><?php ?></td>
<td style="width: 5%;color: black;font-size: 16px;"><?php ?></td>
</tr>
<?php } ?>
</tbody>
</table>
It worked! Thank you very much
– Well
@Well that it worked. The best way to thank you is to put the answer as correct. I am grateful to help!
– 8biT