[eluser]ranjitbd[/eluser]
//this is the controller
<?php
class Holiday extends Controller {
function getDestination()
{
$data = array();
$this->load->model($this->config->item('generalModel'), 'getDes',TRUE);
$data['desPack']=$this->getDes->desPackName();
print_r($data);
// echo $data['destination_name']; //its not executing showing error
exit;
}
}
?>
//this is the model
<?php
class User_model extends Model
{
function User_model()
{
parent::Model();
}
function desPackName()
{
$query = $this->db->get('destination');
return $query->result();
}
}
?>
//output of this code
Array ( [desPack] => Array ( [0] => stdClass Object ( [destination_id] => 1 [destination_name] => Around Dhaka [destination_description] => Dhaka is a magnificent city, where people & history are thousand years old. [destination_image] => dhaka.jpg [remarks] => ) [1] => stdClass Object ( [destination_id] => 2 [destination_name] => Around Chittagong [destination_description] => Chittagong is a magnificent city, where people & history are thousand years old. [destination_image] => chittagong.jpg [remarks] => ) [2] => stdClass Object ( [destination_id] => 3 [destination_name] => Aroung Coxs Bazar [destination_description] => Coxs Bazar is a magnificent city, where people & history are thousand years old. [destination_image] => coxsbazar.jpg [remarks] => ) [3] => stdClass Object ( [destination_id] => 4 [destination_name] => Around Sylhet [destination_description] => Sylhet is a magnificent city, where people & history are thousand years old. [destination_image] => sylhet.jpg [remarks] => ) [4] => stdClass Object ( [destination_id] => 5 [destination_name] => Around Khulna [destination_description] => Khulna is a magnificent city, where people & history are thousand years old. [destination_image] => khulna.jpg [remarks] => ) [5] => stdClass Object ( [destination_id] => 6 [destination_name] => Hill District [destination_description] => Dhaka is a magnificent city, where people & history are thousand years old. [destination_image] => hills.jpg [remarks] => ) ) )
//i have to execute the following line of code
// echo $data['destination_name']; //its not executing showing error
//the output should be
Around Dhaka