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

  • Home
  • SEARCH
  • 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 8323311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:41:13+00:00 2026-06-08T23:41:13+00:00

class Registration_model extends CI_Model { function __construct() { parent::__construct(); } function check_email_availability($email) { $sql

  • 0
class Registration_model extends CI_Model {

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

    function check_email_availability($email)
    {
        $sql = "CALL proc_1301('$email');"; 
        $query = $this->db->query($sql) or die(mysql_error()); 
        return $query->row_array();
    }

    function check_username_availability($username)
    {
        $sqlt = "CALL proc_1303('$username');"; 
        $query = $this->db->query($sqlt) or die(mysql_error()); 
        return $query->row_array();
    }

    function process_registration($username, $email, $password)
    { 
        $sql = "CALL `proc_1302`('$username', '$email', '$password');"; 
        $query = $this->db->query($sql) or die(mysql_error()); 
        return $query->result_array();   
    }

this is my controller code which calls three functions from model one by one:

$emailCheckRes = $this->Registration_model->check_email_availability($email); 
$usernameCheckRes = $this->Registration_model->check_username_availability($username); 
$this->data['regRes'] = $this->Registration_model->process_registration($username, $email, $password);

my problem is when i run only one function it runs successfully but when i run two of them or all three it shows blank page… any idea why ???

SOLUTION

So finally the only solution we got for my own problem is :

/* ADD THIS FUNCTION IN SYSTEM/DATABASE/DB_ACTIVE_REC */
/* USAGE $this->db->freeDBResource($this->db->conn_id); */
function freeDBResource($dbh){
    while(mysqli_next_result($dbh)){
            if($l_result = mysqli_store_result($dbh)){
              mysqli_free_result($l_result);
            }
        }
}
  • 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-06-08T23:41:17+00:00Added an answer on June 8, 2026 at 11:41 pm

    The problem is related to CodeIgniter’s active recors and multiple database stored procedure calling.

    First of all check that dbdriver parameter (application/config/database.php) is set to mysqli.
    Then, as described in “Calling a stored procedure from CodeIgniter’s Active Record class” question on StackOverflow, adding to system/database/DB_active_rec.php the following function:

    function freeDBResource($dbh){
        while(mysqli_next_result($dbh)){
                if($l_result = mysqli_store_result($dbh)){
                  mysqli_free_result($l_result);
                }
            }
    }
    

    ..And in your controller use:

    $this->db->freeDBResource($this->db->conn_id);
    

    after any stored procedure calling.

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

Sidebar

Related Questions

class A: pass def b(self): print('b') A.b = b a = A() At this
class a{ public void foo(int a){ System.out.println(super); } } class b extends a{ public
I have this form.py: from shortcut import get_timezone class HostCreateForm(forms.ModelForm): def save(self, commit=True): host1
When using this object model: interface IInterface {} class Impl : IInterface { public
I have a simple question. This is my profile: class Profile(models.Model): user = models.ForeignKey(User,
I have the following code: class UserForm(ModelForm): email = forms.EmailField(widget = forms.TextInput(attrs ={ 'id':'email'}),
I have a Django model like this: class Registration(models.Model): appId =models.CharField(max_length = 100) registeredUser
I try to use PHPMailer to send registration, activation. etc mail to users: require(class.phpmailer.php);
class Widget; std::vector< std::shared_ptr<Widget> > container class Criterium { public: bool operator()(const Widget& left,
Class 1 private void checkDuplicateCustomer(BulkCustomerVO bulkCustomerVO) { PagedDuplicateCustomerVO duplicateCustomerVO = new PagedDuplicateCustomerVO(); duplicateCustomerVO.setCustomer(bulkCustomerVO.getCustomerVO()); duplicateCustomerVO

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.