I have a php function that returns me in a table all html NrPlaca but I would need a filter in the php function to show in the table only the DsTpVeiculo > are bitruck, I would like some tips on how to do it. Next image of the database:
Function php:
class ProgDAO{
private $conn;
public function __construct($connection) {
$this->conn = $connection;
}
public function ListaTodos(){
$results = array();
$stmt = $this->conn->prepare(
'SELECT * FROM GTCLogist'
);
$stmt->execute();
if($stmt) {
while($row = $stmt->fetch(PDO::FETCH_OBJ)) {
$prog = new Prog();
$prog->setplaca($row->NrPlaca);
$prog->setmot(stripslashes($row->DsMotorista));
$results[] = $prog;
}
}
return $results;
}
}
Table that shows the data:
<table border="1" width="30%">
<tr>
<th>BITRUCK</th>
<th>Motorista</th>
<th>Data Saída</th>
<th>Origem</th>
<th>Destino</th>
<th>Prev. Cheg. Dest</th>
<th>Carga/Manifesto</th>
<th>Adiantamento Fincanceiro</th>
<th>Agendas</th>
<th>Malote</th>
<th>Obs</th>
</tr>
<?php
foreach ($controller->listarEmail() as $objProg) {
?>
<tr>
<td><?php echo $objProg->getplaca(); ?></td>
<td><?php echo $objProg->getmot(); ?></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php
}
?>
</table>