Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6723219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:32:35+00:00 2026-05-26T09:32:35+00:00

I am using latest codeigniter and trying to call stored procedure from my model.

  • 0

I am using latest codeigniter and trying to call stored procedure from my model. Also I am using mysqli as database driver. Now I am having an error when I call two stored procedures. Following is the error:

Error Number: 2014

Commands out of sync; you can’t run this command now

call uspTest();

Filename: E:\wamp\www\reonomy-dev\system\database\DB_driver.php

Line Number: 330

Note that when I call a single stored procedure it works fine. Here is the code for model.

class Menus_model extends CI_Model {

function __construct()
{
    parent::__construct();

}

public function getMenus()
{
    $query = $this->db->query("call uspGetMenus()");

    return $query->result();
}

public function getSubMenus()
{
    $query = $this->db->query("call uspTest()");
    return $query->result();
}

}

Here is the code from controller

class MYHQ extends CI_Controller {

public function __construct()
{
    parent::__construct();
    $this->load->model('menus_model');
}

public function index()
{
    $menu = $this->menus_model->getMenus();
    $submenu = $this->menus_model->getSubMenus();
}

}

Is there any solution without hacking the core of codeigniter??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:32:36+00:00Added an answer on May 26, 2026 at 9:32 am

    This seems to be a bug in CodeIgniter. How come it’s still in there is beyond me.
    However, there’s a couple of ways to overcome it.

    Check here: http://codeigniter.com/forums/viewthread/73714/
    Basically, you modify mysqli_result.php to include next_result() function and make sure to call it after every stored proc. call.
    Just note that it assumes you’re using mysqli as your DB driver… but you can probably do something similar with any other. You can change your driver in /application/config/database.php It’s the line that says

    $db[‘default’][‘dbdriver’] = ‘mysql’;

    by default. Change it to:

    $db[‘default’][‘dbdriver’] = ‘mysqli’;

    You could also just close/reopen a DB connection between the calls, but I would definitely advise against that approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the latest version of Resharper (4.5.x) with VS2008. Every now and then (pretty
I am using the latest NHibernate 2.1.0Beta2. I'm trying to unit test with SQLite
I'm using the latest indy snapshot (installed yesterday) and newest SSL libraries. When trying
I am using the CodeIgniter framework to work on my latest website. In my
I'm trying to get the font-weight of a property using latest jquery, doesn't work
I am using latest Xcode, and trying to find memory leaks. When i use
Using the latest 1.x (1.7.3) version of CodeIgniter, I get 404 errors on gclid
I am building an application using the latest copy of Codeigniter 2.0. My application
i have done SQL insertion with NOW() using codeigniter. instead of current time i
i'm using latest svn version (1.6) of zfdebug with zend 1.11.4 and trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.