[eluser]Corbee[/eluser]
Hi,
I'm currently a newbie trying to learn ci, but it appears that my code won't work.
Well it does work, but it didn't display the thing that needs to be displayed.
Here is what I'm trying to achieve, I have a table(table A) where each rows has a
link that says see items, the item has a separate table(table B), but it has a reference id to Table A. For Example:
Table A
tableAID info1 info2
Table B
tableBID infoA infoB tableAID
I didn't get an error, but the output displayed are all gibberish
here is my model
Code:
function getTableB(id)
{
$data = array();
$options = array('tableAID' => $id);
$q=$this->db->get('TableB',$options);
if ($q->num_rows() > 0)
{
$data = $q->row_array();
}
$q->free_result();
return $data;
Controller
Code:
function viewitems($id)
{
$data['title'] = "Manage Data";
$data['main'] = 'admin_tableb_home';
$data['TableB'] = $this->MTable->getTableB($id);
$this->load->view('dashboard',$data);
}
View
Code:
<h1><?php echo $title;?></h1>
<?php
if ($this->session->flashdata('message')){
echo "<div class='message'> ".$this->session->flashdata('message')." </div>";
}
if (count($TableB)){
foreach ($tableB as $key => $list)
{
echo $list['tableBID']."\n";
echo $list['InfoA']."\n";
echo $list['InfoB']."\n";
}
}
?>
does anyone know what went wrong?
Thanks