[eluser]Fr334Ever[/eluser]
hi there ,
I have a little problem :
I have this controler :
Code:
<?php
class C_related extends Controller
{
function related1()
{
$this->load->model('m_related');
$data['rel'] = $this->m_related->getAll();
$this->load->view('produse/v_product', $data);
}
}
?>
and this model
Code:
<?php
class M_related extends Model
{
function getAll()
{
$this->db->limit(3);
$q = $this->db->get('product');
if($q->num_rows() > 0)
{
foreach ($q->result() as $row)
{
$data[] = $row;
}
return $data;
}
}
}
?>
and this view
Code:
<html>
<body>
<div id="cat1">
<p>Related</p>
<?php foreach($rel as $r) : ?>
<?php echo $r->name; ?></br>
<?php endforeach; ?>
</div>
</body>
</html>
I wanth to put the v_related in to another view like : products/prod.php , and I tried an I kand fetch any data , when I test the controller it works bunt when I put this
<?php
$data = array('rel' => $r->name);
$this->load->view('v_related', $data);
print_r($data);
?>
in tot he othen view I don' see anithing .
Please help