注意:未定义的变量:第122行的******中的table_rows

时间:2017-02-17 20:21:23

标签: php

我不明白我犯了什么错误,“table_rows”被定义了。有什么我想念的吗?

确切的错误是“注意:未定义的变量:第122行/home/dbookatay/carcityofdanbury.com/Admin/tables.php中的table_rows”

$result = mysqli_query($conn,"SELECT * FROM Inventory ORDER BY year");
while($row = mysqli_fetch_array($result)){
$count = $result->num_rows;
if ($count) {

$stock = $row['stock'];
$year = $row['year'];
$make = $row['make'];
$model = $row['model'];
$trim = $row['trim'];
$vin = $row['vin'];
$vin6 = substr($vin, -6);

if ($row['trim'] != "Base") {
    $vehicle = $row['year']." ".$row['make']." ".$row['model']." ".$row['trim'];
} else {
    $vehicle = $row['year']." ".$row['make']." ".$row['model'];
}

if($row['title_status'] == "TMU") {
    $mileage = 'TMU';
} elseif ($row['mileage']) {
    $mileage = number_format($row['mileage']);
}

if($row['purchase_cost'] != "0.00") {
    $cost = '$'.number_format($row['purchase_cost']);
} else {
    $cost = ' ';
}

// Engine
if($row['asperation']) {
    $engine = $row['liters'].' l. '.$row['asperation'].' '.$row['cylinders'].' cyl';
} else {
    $engine = $row['liters'].'L.'. $row['cylinders'].' cyl';
}

$asking = '$'.number_format($row['price']);

// # of days in Inventory
$purchased = strtotime($row['purchase_date']);
$age = $now - $purchased;
$age = number_format(floor($age / (60 * 60 * 24))).' days';

// Vehicle's current status
$status = array($row['status'], ucfirst($row['status']));

$table_rows .= '
<tr>
    <td class="status '.$status[0].'"><i></i><p>'.$status[1].'</p></td>
    <td>'.$stock.'</td>
    <td><a href="index.php?cat=Sales&action=Edit&stock='.$stock.'">'.$vehicle.'</a></td>
    <td class="vin_6">
        <a class="popr" data-id="vin#'.$stock.'">'.$vin6.'</a>
        <div class="popr-box" data-box-id="vin#'.$stock.'">
            <i class="close"></i>
            <h5>'.$vehicle.'</h5>
            <p class="vin">'.$vin.'</p>
        </div>
    </td>
    <td class="vin_6">'.$mileage.'</td>
    <td>'.$age.'</td>
    <td>'.$asking.'</td>
    <td>'.$cost.'</td>
    <td>
        <a class="popr" data-id="sell#'.$stock.'"><i class="fa fa-money" aria-hidden="true"></i> Sell</a>
        <div class="popr-box" data-box-id="sell#'.$stock.'">
            <h5>'.$vehicle.'</h5>
            <a href="index.php?cat=Sales&sub=Lead&stock='.$stock.'"><i class="fa fa-user-plus" aria-hidden="true"></i> New Lead</a>
            <a href="#"><i class="fa fa-usd" aria-hidden="true"></i> Take Deposit</a>
            <a href="#"><i class="fa fa-bank" aria-hidden="true"></i> New Deal</a>
        </div>

        <a class="popr" data-id="service#'.$stock.'"><i class="fa fa-plus" aria-hidden="true"></i> Service</a>
        <div class="popr-box" data-box-id="service#'.$stock.'">
            <h5>'.$vehicle.'</h5>
            <a href="#"><i class="fa fa-wrench" aria-hidden="true"></i> Service Shop</a>
            <a href="#"><i class="fa fa-shower" aria-hidden="true"></i> Prep Shop</a>
            <a href="#"><i class="fa fa-ambulance" aria-hidden="true"></i> Bodyshop</a>
        </div>

        <a class="popr" data-id="print#'.$stock.'"><i class="fa fa-print" aria-hidden="true"></i> Print</a>
        <div class="popr-box" data-box-id="print#'.$stock.'">
            <h5>'.$vehicle.'</h5>
            <a href="#"><i class="fa fa-certificate" aria-hidden="true"></i> Window Sticker</a>
            <a href="#"><i class="fa fa-sticky-note-o" aria-hidden="true"></i> Buyer\'s Guide</a>
            <a href="#"><i class="fa fa-clone" aria-hidden="true"></i> Both <span class="small">(Window &amp; Buyer\'s)</span></a>
            <a href="#"><i class="fa fa-tag" aria-hidden="true"></i> Mirror Hanger</a>
            <a href="#"><i class="fa fa-file-o" aria-hidden="true"></i> Internal History</a>
            <a href="#"><i class="fa fa-wpforms" aria-hidden="true"></i> Loaner Form</a>
        </div>

    </td>
</tr>
';
} else {
    $table_rows = NULL;
}
}

0 个答案:

没有答案