Part of the EllisLab Network
   
 
two different queries returning same data
Posted: 10 June 2008 12:38 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  21
Joined  05-16-2008

Hi, I need some help, with a strange behavior of CI or maybe im too novice.
Im working with Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi

//in a MODEL i have some funcions with queries
function getUsers(){
  $qryUsrs
= $this->db>query('select * from users');
  return
$qryUsrs->result_array();
}
function getDocs(){
  $qryDocs
= $this->db>query('select * from documents');
  return
$qryDocs->result_array();
}

//in my CONTROLLER i call both
$this->load->model('qry_model');
$data['users'] = $this->qry_model->getUsers();

// Here im trying to clean the array
$this->db->result_array = array();

$data['docs'] = $this->qry_model->getDocs();
$this->load->view('my_view',$data);

//in my VIEW I display both queries each in a table
echo $this->table->generate($users);
if(
$users === $docs) echo 'THE ARRAYS HAVE THE SAME DATA....'; //This always print
echo $this->table->generate($docs);

The problem is that in both tables I get exactly the same data, i suppose i need to ‘clear’ the info in the array before getting another, someone knows how i must to proceed to get the correct data in each table?

Thanks in advance

 Signature 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Eros, cities builder.

Profile
 
 
Posted: 10 June 2008 04:59 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6507
Joined  03-23-2006

You betcha. $this->table->clear() should do it for you.

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design

Profile
 
 
Posted: 11 June 2008 09:20 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  21
Joined  05-16-2008

Hi, sorry Derek. I already tried this (table.clear), and i get the same data.

As you can see I evaluate $users vs $docs and i see that the info is the same.

please another suggestion.

 Signature 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Eros, cities builder.

Profile
 
 
Posted: 11 June 2008 09:31 AM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6507
Joined  03-23-2006

I see that you’ve already got this exact question in another thread (where I see this was already suggested) so I feel a bit like I’ve wasted both our time here.  I’m closing this thread to keep all discussion in one place.

http://codeigniter.com/forums/viewthread/81841/

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 61058 Total Logged-in Users: 20
Total Topics: 73867 Total Anonymous Users: 0
Total Replies: 398461 Total Guests: 346
Total Posts: 472328    
Members ( View Memberlist )
Newest Members:  tanjadebieSan2kakifemreSchottec2kmeenazterjinFuadgeorge_k_alliskhalidmhamood