Skip to content

Instantly share code, notes, and snippets.

@mpmont
Created April 10, 2012 10:29
Show Gist options
  • Save mpmont/2350195 to your computer and use it in GitHub Desktop.
Save mpmont/2350195 to your computer and use it in GitHub Desktop.
<select>
<?php foreach( $articles as $article): ?>
<option id="<?= article->id ?>"><?= $article->title ?></option>
<?php endforeach; ?>
</select>
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Articles extends CI_Model {
public function GetAll()
{
$query = $this->db->get('articles');
return $query->result();
}
}
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Controllername extends CI_Controller {
public function index()
{
$this->load->model('articles_model', 'article');
$data['articles'] = $this->article->GetAll();
$this->load->view('articles_list');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment