Skip to content

Instantly share code, notes, and snippets.

@travi5567
Last active December 11, 2015 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save travi5567/4595353 to your computer and use it in GitHub Desktop.
Save travi5567/4595353 to your computer and use it in GitHub Desktop.
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