Welcome Guest, Not a member yet? Register   Sign In
How to reference the value of a result in a second query
#1

Hi everyone, I am new to PHP and codeigniter...

I have two tables

one stores the name of different id and organization name

second table contains people information with id for the organization they belong to

I want to translate the name of the organization for each person from the organization table matching it on the organization id

I know how to write the query however, I am unable to figure out how to reference the organization id as part of a result set i.e.

$org_ID = $row->org_ID;
$query = $this->db->get_where('organization', array('orgID' => $org_ID); <<<<<< this does not work and I do not know how
foreach ($query->result() as $r) <<<<< reference the $row->org_ID in the query
{?>
<td><?php echo $r->orgName;?></td> <<<<<<<< this is what I ultimately want to name of the organization and not it's
<?php } ?> <<<<<<<< record identifier.

Can anyone show me how to reference the data in the result set in a second query?

I would be so thankful...
Reply


Messages In This Thread
How to reference the value of a result in a second query - by HMiles - 12-12-2015, 03:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB