Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if (! defined('BASEPATH')) exit('No direct script access');
- class Bruger_model extends CI_Model
- {
- function __construct()
- {
- $this->load->database();
- parent::__construct();
- }
- public function get_topics()
- {
- $query = $this->db->select('topics.name AS topic_name, quotes.name AS quote_name')
- ->from('quotes')
- ->join('topics', 'quotes.topic_id = topics.id')
- ->where('quotes.user_id', '1')
- ->order_by('topics.name', 'ASC');
- $topics = array();
- foreach ($query->results() as $row)
- {
- $topics[$row->topic_name][] = $row->quote_name;
- }
- return $topics;
- }
- }
- /* End of file Class_name.php */
- /* Location: ./application/models/Class_name.php */
Add Comment
Please, Sign In to add comment