Click here to Skip to main content
15,911,360 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every one!
I have built 2 classes:
1, DB
PHP
class DB extends MySQLi{
    function getRecordSet($sql){
       ...
       //Return record set
    }
}

2, Department
PHP
class Department{
    var $db;
    function getDepartment(){
        return $this->db->getRecordSet('...');
    }
}

Problem:
PHP
$dept=new Department();
$db=new DB();
$dept->db=$db;
//Problem
$department=$dept->getDepartment();
$department2=$dept->getDepartment();

My problem is that variable $department has record set, but $department2 is bool(false). I use this because I need to use departments twice.

Note: I already test another way that store departments getting the first time in another attribute, but cannot fetch.
Please help me!
Thanks!
Posted
Updated 27-Nov-11 15:07pm
v4
Comments
omid.nazifi 27-Nov-11 4:35am    
hi Bun
but I check now and its ok!
There is not any porblem
Bun Leap_kh 27-Nov-11 22:23pm    
hi Omid
That code I used store procedure. However, if I use select statement, it works!
But I need to use store procedure.
Thanks!

1 solution

Oh I see!
It's because of I'm using with MySqli. To use multiple query with MySqli, we need to prepare for next result by using function mysqli::next_result() before calling the second or next time.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900