$empId = $row['emp_id']; $deductions = $row['deductions']; $total = $row['total_price']; $seller = $sellerCon->getSeller($sellerId); $seller = $seller->fetch(); $personId = $seller['person_id']; $person = $personCon->getPerson($personId); $person = $person->fetch(); $sellerName = $person['first_name'] . ' ' . $person['surname']; $car = $carCon->getCar($carId); $car = $car->fetch(); $modelId = $car['model_id']; $model = $modelCon->getModel($modelId); $model = $model->fetch(); $modelName = $model['model_name']; $make = $makeCon->getMake($model['make_id']); $make = $make->fetch(); $makeName = $make['make_name']; $year = $car['year']; $rego = $car['rego_number']; $fo = $foCon->getFeaturesForOffer($offerId); $fo = $fo->fetchAll(); $featureIds = array(); foreach ($fo as $f) { $featureIds[] = $f['feature_id']; } foreach ($featureIds as $featureId) { $f = $featureCon->getFeature($featureId); $f = $f->fetch(); $features[] = $f['feature_name']; }
function dollar_format($value) { $value = floatval($value); return '$' . number_format($value, 2); } if (isset($_GET['id'])) { $offerId = $_GET['id']; $carOffer = $offerCon->getOffer($offerId); if ($carOffer->errorInfo()[2] == null) { $searchResult = true; $carOffer = $carOffer->fetch(); $carCar = $carCon->getCar($carOffer['car_id']); $carCar = $carCar->fetch(); $carModel = $modelCon->getModel($carCar['model_id']); $carModel = $carModel->fetch(); $carMake = $makeCon->getMake($carModel['make_id']); $carMake = $carMake->fetch(); $carMedia = $mediaCon->getMediaForOffer($carOffer['offer_id']); $carMedia = $carMedia->fetchAll(); $featureIds = array(); $fos = $foCon->getFeaturesForOffer($offerId); $fos = $fos->fetchAll(); $carFeatures = array(); foreach ($fos as $fo) { $featureIds[] = $fo['feature_id']; } foreach ($featureIds as $featureId) { $f = $featureCon->getFeature($featureId); $f = $f->fetch(); $carFeatures[] = $f; }
* Date: 16/09/15 * Time: 1:22 PM */ /** * Backend page for administrators and Staff of Cyril's Classic Cars to edit makes */ require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php'; if (isset($_SESSION['authenticated'])) { if ($_SESSION['authenticated'] == true) { $editResult = null; $makeId = null; $makeName = null; $makeCon = new MakeController(); if (isset($_GET['id'])) { $makeId = $_GET['id']; $make = $makeCon->getMake($makeId); if ($make->errorInfo()[2] == null) { $row = $make->fetch(); $rowCount = count($row); if ($rowCount = 1) { $makeName = $row['make_name']; } } } if (isset($_POST['hdnAction'])) { if ($_POST['hdnAction'] == 'update') { $result = $makeCon->updateMake($_POST['hdnMakeId'], $_POST['txtMakeName']); $makeName = $_POST['txtMakeName']; if ($result->errorInfo()[2] == null) { $editResult = true; } else {
public function printModels() { $models = $this->getModels(); $makeCon = new MakeController(); if ($models->errorInfo()[2] == null) { $rows = $models->fetchAll(); $rowCount = count($rows); if ($rowCount > 0) { ?> <table class="table table-responsive table-hover"> <tr> <th>Make Name</th><th>Model Name</th><th>Actions</th> </tr> <?php foreach ($rows as $row) { $make = $makeCon->getMake($row['make_id']); $make = $make->fetch(); ?> <tr> <td><?php echo $make['make_name']; ?> </td><td><?php echo $row['model_name']; ?> </td> <td><a href="./view.php?id=<?php echo $row['model_id']; ?> " class="btn btn-info"><span class="glyphicon glyphicon-briefcase"></span> View</a> <a href="./edit.php?id=<?php echo $row['model_id']; ?> " class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span> Edit</a> <a href="./delete.php?id=<?php echo $row['model_id']; ?> " class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> Delete</a></td> </tr> <?php } ?> </table> <?php } else { ?> <div class="alert alert-info" role="alert"> <strong>No results.</strong> There are no models to display<br/> Use the form above to add some. </div> <?php } } else { ?> <div class="alert alert-danger" role="alert"> <strong>Uh oh!</strong> The database returned the following error:<br/> <em><?php echo $models->errorInfo()[2]; ?> </em> </div> <?php } $models->closeCursor(); }