11-24-2016, 10:49 PM
So this is where the whole results vs first comes in. If you're only going to get 1 user or 1 item because you are searching by id or something that is unique, you use
Then to get the item back, you do
BUT, say you are looking for all of your orders (like in your example), it's this...
That gives you an object (You can see that if you do dump($results)
So you most likely want to do a foreach loop to generate your table of orders.
Do your table headings...
THEN you foreach your rows
Code:
$result=$query->first();
Code:
$result->columname.
BUT, say you are looking for all of your orders (like in your example), it's this...
Code:
$query = $db->query("SELECT * FROM ORDERS");
Code:
$results = $query->results();
That gives you an object (You can see that if you do dump($results)
So you most likely want to do a foreach loop to generate your table of orders.
Do your table headings...
Code:
<thead>
Code:
<tr>
Code:
<th>Delete</th><th>ID</th><th>Date</th><th>Order Number</th><th>Functions</th>
Code:
</tr>
Code:
</thead>
THEN you foreach your rows
Code:
<?php
Code:
foreach ($results as $result) {
Code:
?>
Code:
<tr>
Code:
<td><?=$result->id?></td>
Code:
<td><?=$result->date?></td>
Code:
<td><?=$result->ordernumber?></td>
Code:
<td><?=$result->system?></td>
Code:
<tr>
Code:
<?php } ?>