inset data into table with foreign key and display a single data containing the information of both table
<p>I want to display the information from table that contains the foreign key.
I just want to display one data from that table and associated information of another table related by foreign key. </p>

<p>Please help</p>

<p>Problem is to display only</p>

<p>Model</p>

<pre><code>function getreport() {
   $query = $this-&gt;db-&gt;get('labreport_db');
   $res = $this-&gt;db-&gt;query("SELECT labreport_db.R_ID, patient_db.name, labreport_db.Doctor
FROM labreport_db INNER JOIN patient_db
ON labreport_db.P_ID=patient_db.id;");
    return $res-&gt;result();
}
</code></pre>

<p>Controller</p>

<pre><code>public function reportDisplay(){
  $data['posts'] = $this-&gt;labdoc_model-&gt;getreport();

  $this-&gt;load-&gt;view('SystemAdminUser/labreport',$data);
}
</code></pre>