• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Errors

#7
[eluser]Sumon[/eluser]
In your controller you have
Code:
$data['mainf'] = $this->MProducts->getMainFeature();
$skip = $data['mainf']['id'];
lets have a close look in model
Code:
function getMainFeature(){
$data = array();
$this->db->select("id,name,shortdesc,image");
$this->db->where('featured', 'true');
$this->db->where('status', 'active');
$this->db->orderby("rand()");
$this->db->limit(1);
$Q = $this->db->get('products');
if ($Q->num_rows() > 0 ){
foreach ($Q->result_array() as $row){
    $data = array(
    "id" => $row['id'],
    "name" => $row['name'],
    "shortdesc" => $row['shortdesc'],
    "image" => $row['image']
    );
     }
}
$Q->free_result();
return $data;
}// end getMainFeature
As though getMainFeature() function return a a multi dimensional array, so $data['mainf'] in controller can't be accessed as
Code:
$data['mainf']['id'];
i think, this is permissible to access as
Code:
$index=0; //for example
$data['mainf'][$index]['id'];
and i hope second problem
Code:
A Database Error Occurred
will solved automatically. let me know is it works for you?


Messages In This Thread
Errors - by El Forum - 09-19-2008, 08:41 AM
Errors - by El Forum - 09-19-2008, 08:49 AM
Errors - by El Forum - 09-19-2008, 08:52 AM
Errors - by El Forum - 09-19-2008, 09:47 AM
Errors - by El Forum - 09-19-2008, 10:11 AM
Errors - by El Forum - 09-19-2008, 10:12 AM
Errors - by El Forum - 09-19-2008, 01:15 PM
Errors - by El Forum - 09-19-2008, 01:48 PM
Errors - by El Forum - 09-19-2008, 03:55 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.