0
I have this foreach below that lists results of a Select, I would like to name according to the number, as I did below in IF, but it hasn’t worked yet..
foreach($result as $row)
{
$segurado[] = $row['SEGURADO'];
$data[] = $row['DATA'];
$status_seguro1 = $row['STATUS_SEGURO'];
if($status_seguro1 == '1') {$status_seguro[] = 'Vistoria';}
if($status_seguro1 == '2') {$status_seguro[] = 'Primeira Parcela';}
if($status_seguro1 == '3') {$status_seguro[] = 'Apólice';}
if($status_seguro1 == '4') {$status_seguro[] = 'Cancelado';}
}
Not working means what? how the final format should look?
– rray
If it comes from the BD the number 1 in the status_seguro1 should be 'Survey' in the final format, and so on...
– Alh
And what happens to that code? Doesn’t the writing go? The number goes?
– rray
is giving some error as I am getting the number '2' but is appearing written Policy (which is referenced to the number '3'
– Alh
Use strtr http://php.net/manual/en/function.strtr.php
– Luiz Gustavo Costa Ceolin