In my model I get the entire order
table.
return $this->db->get('order')->result();
In my view i do a foreach
to loop through the data.
<?php foreach ($orders as $order) : ?>
<tr>
<td><?php echo $order->id; ?></td>
<td><?php echo $order->order_status; ?></td>
<td><?php echo $order->cart; ?></td>
. . .
<?php endforeach; ?>
Ok so that works like a charm. However I need to be able to do some data arranging here.
- I want to be able to sort records by
id
so that I can get the latest on top - I want to split the results (pagination) say every 25 records and add the (go to next page link)
I'm using Codeigniter and building on the MVC pattern. So is their a library perhaps or built-in functions in CI
that allow me accomplish these 2 objectives? I appreciate all helpful advice, code examples and general guidance. Thank you in advance for your time! :)
Edit 1
Sorry I didn't mention this.. Can someone give me an example of how the query
needs to be structured return $this->db->get('order', 25)->result();
isn't exactly giving me the desired result here.