• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
two different queries returning same data

#1
[eluser]tjmthome[/eluser]
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

Code:
//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

#2
[eluser]Derek Allard[/eluser]
You betcha. $this->table->clear() should do it for you.

#3
[eluser]tjmthome[/eluser]
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.

#4
[eluser]Derek Allard[/eluser]
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://ellislab.com/forums/viewthread/81841/


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.