Issue
I'm a rookie on codeigniter and I'm trying to solve a problem where I try to get some images from the database using a foreach cicle
I have this on my controller to get the images
$data['products'] = '.base_url('$this->Cart_model->get_img()').';
and this on my model
public function get_img()
{
$sql = "SELECT image FROM products";
$query = $this->db->query($sql);
return $query->result_array();
}
In my view it get me a syntax error beacause something is wrong in the controller
Already checked the View.tpl and everything is fine, must be something in the controller
Solution
You forgot the concatenation operator to concatenate the strings.
$data['products'] = '.base_url(' . $this->Cart_model->get_img() . ').';
Answered By - Alex Karshin
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.