<?php
include("/var/www/2a685b61-ba1a-4056-abd9-0883231735ff/public_html/monzaclube/config.php");
$conecta = new mysqli(BD_HOST,BD_USUARIO,BD_SENHA,BD_BANCO);

$i = 1;
$sql = $conecta->query("SELECT * FROM modelos ORDER BY id ASC");
while ($consulta = $sql->fetch_assoc()){
$evNum = 'modelo_'.$i;
$modelo[$evNum]['id'] = $consulta['id'];
$modelo[$evNum]['descricao'] = $consulta['descricao'];
$modelo[$evNum]['motor'] = $consulta['motor'];
$modelo[$evNum]['carroceria'] = $consulta['carroceria'];
$anoModelo = unserialize($consulta['anoModelo']);
$modelo[$evNum]['anoModelo'] = $anoModelo;
$i = $i + 1;}

$json_string = json_encode($modelo);

echo $json_string;
?>