Fipe table Change year 3200

2

Hello ... I have a system that pulls the fipe table information, but it pulls the year 2018 or 2019 as 3200

How to change?

This is the code that searches through a dynamic select

$conectando = "SELECT * FROM fp_ano WHERE codigo_modelo = '$ano' ORDER BY 
 ano DESC";
$dados = mysql_query($conectando) or die(mysql_error());
  if(mysql_num_rows($dados) == 0){
  echo '<option value="0">'.htmlentities('Carregando...').'</option>';
  }else{
  echo '<option value="0">Escolha o ano desejado </option>';
  while($funcao002 = mysql_fetch_assoc($dados)){
  echo utf8_encode('<option 
  value="'.$funcao002['id_ano'].'">'.$funcao002['ano'].'</option>');
  }
  }

    
asked by anonymous 18.05.2018 / 20:38

1 answer

0

You can solve this by changing the code 3200 to Zero KM in the presentation layer:

SELECT id_ano,
       CASE ano
         WHEN 3200 THEN 'Zero KM'
         ELSE ano
       END AS ano
  FROM fp_ano
 WHERE codigo_modelo = '$ano'
 ORDER BY ano DESC
    
18.05.2018 / 21:27