Skip to content

Instantly share code, notes, and snippets.

@ckdarby
Created June 6, 2012 18:20
Show Gist options
  • Save ckdarby/2883718 to your computer and use it in GitHub Desktop.
Save ckdarby/2883718 to your computer and use it in GitHub Desktop.
CREATE DEFINER=`user`@`localhost` PROCEDURE `test`()
BEGIN
SELECT * FROM users;
END
<?php
/**
* application/models/testmodel.php
*
*/
class Testmodel extends CI_Model {
public function __construct(){
parent::__construct();
}
public function test(){
$query = $this->db->query("CALL test");
return $query->result();
}
}
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* application/controllers/welcome.php
*
*/
class Welcome extends CI_Controller {
public function index()
{
$this->load->model('Testmodel');
$this->Testmodel->test();
$this->load->view('welcome_message');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment