I’m doing the following queries in codeigniter and can’t figure out how to get the second query to work. How do I get an array of just the values from my first query and use that in my second?
function application()
{
$user_id = $this->tank_auth->get_user_id();
$this->db->select('app_id')->from('using')->where('user_id' , $user_id);
$query = $this->db->get();
$row = $query->result_array();
if ($query->num_rows() > 0) :
$this->db->select('app_name')->from('applications')->where('id' , $row['app_id']);
$body['query'] = $this->db->get();
endif;
$this->load->view('apps_view', $body);
If I comment out the second query and var_dump($row);
it gives me:
array(2) { [0]=> array(1) { [“app_id”]=> string(1) “2” } [1]=> array(1) { [“app_id”]=> string(1) “3” } }
I decided to do multiple queries instead of a join because I will be adding additional columns to select from the second query.