I am trying to the array variable $popular_data
in Codeigniter’s view, it is installed with Modesty script.
I tried to append this variable to the one already passed to view by array_merge, $data + $variable
in Model:
public function get_popular_products(){
$popular_data = $this->db->query(‘SELECT... ’)->result_array();
return $popular_data;
}
in Controller:
$this->load->model("Popularproduct_model");
$popularproducts = $this->Popularproduct_model->get_popular_products();
var_dump($popularproducts)
here(in controller) shows the queried popular products on top of view as
array(3) {
[0]=>
array(34) {
["id"]=>
string(1) "3"
["title"]=>
string(13) "Patchouli Oil"
["slug"]=>
string(15) "patchouli-oil-3"
...
other variable passed to view as:
$this->load->view('index', $data);
So how to send the $popularproducts
to the view and use the values?
Thanks.