Ejemplo n.º 1
0
             $modelObject = json_encode($modelResults);
         } else {
             $modelObject = null;
         }
         print_r($modelObject);
         return $modelObject;
     }
 } else {
     $makeCon = new MakeController();
     $make = $makeCon->getMakeByName($_POST['txtMake']);
     if ($make->errorInfo()[2] == null) {
         $make = $make->fetch();
         if (count($make) > 0) {
             $makeId = $make['make_id'];
             $modelCon = new ModelController();
             $models = $modelCon->getModelsInMake($makeId);
             if ($models->errorInfo()[2] == null) {
                 $rows = $models->fetchAll();
                 $rowCount = count($rows);
                 if ($rowCount > 0) {
                     $modelResults = array();
                     foreach ($rows as $row) {
                         $modelResults[$row['model_name']] = $row['model_name'];
                     }
                     $modelObject = json_encode($modelResults);
                 } else {
                     $models = $modelCon->getModels();
                     if ($models->errorInfo()[2] == null) {
                         $rows = $models->fetchAll();
                         $rowCount = count($rows);
                         if ($rowCount > 0) {
Ejemplo n.º 2
0
<?php

/**
 * Created by PhpStorm.
 * User: roessler
 * Date: 9/20/15
 * Time: 10:55 AM
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_POST['txtMakeId'])) {
    $modelCon = new ModelController();
    $models = $modelCon->getModelsInMake($_POST['txtMakeId']);
    if ($models->errorInfo()[2] == null) {
        $rows = $models->fetchAll();
        $rowCount = count($rows);
        if ($rowCount > 0) {
            $modelResults = array();
            foreach ($rows as $row) {
                $modelResults[$row['model_id']] = $row['model_name'];
            }
        }
        $modelObject = json_encode($modelResults);
        print_r($modelObject);
        return $modelObject;
    }
}