0
How can I check equal variables within a while?
- Like if there are lines like the same CODE do something...
A Bass put my example
$bd = new MySQLiConnection();
$sql3 = $bd->prepare( "SELECT * FROM agenda_saidas WHERE id_transfer = ? ") or exit( $mysqli->error );
$sql3->bind_param('i', $id_transfer);
$sql3->execute();
$resultcar = $sql3->get_result();
while( $row = $resultcar->fetch_assoc() )
{
$os = $row['os'];
$nome = $row['nome'];
$data = $row['data'];
if(// se $os duplicado ){
$corlinha ='red';
}else{
$corlinha ='white';
}
Example: Imagine these lines at the bottom
If you take into account that there may be many duplicate codes, I think the best solution in this case is to use SQL itself and make a GROUP BY with the ID field, counting how many elements you have in each group...
– Guybrush