Skip to content

Instantly share code, notes, and snippets.



Last active Dec 11, 2015
What would you like to do?
PHP: order,select,get return DATABASE_MODEL
class Workouts_model extends CI_Model {
function getData() {
$this->db->order_by('id', 'DESC');
$this->db->select('id, arms, chest, legs, abbs, back');
$q = $this->db->get('workouts');
if($q->num_rows() > 0) {
foreach ($q->result() as $row) {
$data[] = $row;
return $data;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment