I am trying to fetch data from my data base, but it's not giving me any output. It's only displaying "All Charges". My code is below:
<?php
include 'preCode.php';
include 'header.php';
echo '<body><div class="standardLayout">';
include 'systemMenu.php';
echo '<h4>All Charges</h4>';
$user = unserialize($_SESSION['user']);
echo $query = "SELECT * FROM billingItems WHERE userID=' " . $user-> userID . " ' ORDER BY deliveryTimestamp DESC";
$result = mysqli_query($db, $query);
while ($row = mysqli_fetch_array($result)) {
echo $row['type'] . '<br>' .
'Cost: $' . $row['amount'] . '<br>' .
' Finalized: ' . $row['deliveryTimestamp'] ;
}
echo '</div></body></html>';
$_SESSION['user'] = serialize($user);
include 'footer.html';
?>
Here is the output from echo $query;
:
All Charges object(user)#2 (11) { ["orders"]=> NULL ["fName"]=> string(6) "kimmie" ["lName"]=> string(4) "kaur" ["address"]=> string(10) "6768bbnmmn" ["phone"]=> string(11) "66767798898" ["email"]=> string(6) "kimmie" ["userID"]=> string(3) "108" ["password"]=> string(4) "kaur" ["passwordX"]=> NULL ["amountOwed"]=> string(1) "0" ["zip"]=> string(6) "768798" } SELECT * FROM billingItems WHERE userID=' 108 ' ORDER BY deliveryTimestamp DESC