Table Fipe Change year 3200

Asked

Viewed 152 times

3

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

How to trade?

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>');
  }
  }

Foto

Banco de dados

  • Dude, come up with some code there. I have here a scraper from FIPE but if you don’t present anything to show us it gets complicated.

  • 3200 is the zero km

  • I edited the code... see if you can understand

  • Line 73: https://github.com/Sorackb/VehicleReader/blob/master/src/main/java/lucassouza/vehiclereader/model/businessrule/YearPriceBR.java

  • I do not understand why tbm is appearing 2 3200 (0KM

  • It is pq has model 2018 and 2019 zero KM

  • And how do I show 0km instead of 3200 and how do I know if it’s 2018 and 2019

Show 3 more comments

1 answer

0


You can solve this by changing the code 3200 for 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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.