I can not remove duplicate records in the array
$query = $pdo->prepare("SELECT * FROM produtos order by Data asc");
$query -> execute();
$ContCampos = $query -> rowCount();
$consulArray = array();
while($consulta = $query ->fetch(PDO::FETCH_ASSOC)){
$consulArray[] = array_unique($consulta);
}
foreach($consulArray as $copia1)
{
$nome = $copia1['Nome'];
echo '<option>'.$nome.'</option>';
}
print_r($nome);
I searched the DB, and need to return the date and name, but do not return duplicate data! you have the option to use the select distincs but did not want to use it! I do not know why array_unique is not filtering if someone can help me!
Select result
Array ( [0] => Array ( [id] => 83 [Nome] => Ana Carla Pagung [Verdura] => QUIABO [Quantidade] => 2 [Observacao] => [Unidade] => KILOS [Data] => 2018-05-07 )
[1] => Array ( [id] => 84 [Nome] => Ana Carla Pagung [Verdura] => QUIABO [Quantidade] => 25 [Observacao] => [Unidade] => CAIXAS [Data] => 2018-04-05 )