Skip to content

Instantly share code, notes, and snippets.

@travi5567

travi5567/get_model.php

Last active Dec 11, 2015
Embed
What would you like to do?
PHP: order,select,get return DATABASE_MODEL
<?php
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