Welcome Guest, Not a member yet? Register   Sign In
get different tables data in different array index in a single method in a model
#3

[eluser]ranjitbd[/eluser]
[quote author="ranjitbd" date="1256996435"][code]
// this is a controller name holiday.php

function search_holiday()
{
$data = array();
$data['view_pack'] = $this->holiday->view_package();

echo "<pre>";
print_r($data['view_pack']);

// here i want to get the array value? which is sent by holiday_model.
}


// this is the model name holiday_model.php

function view_package()
{

$sql = "select * from theme_name";
$query['theme'] = $this->db->query($sql);

$sql2 = "select * from destination";
$query['destination'] = $this->db->query($sql2);

return $query->result_array();
// why this line not working ? produce the following errors
//Fatal error: Call to a member function result_array() on a non-object
// so how can i sent $query to controller....

// return $query; // this line does not shows any error.but when i print
// from the controller through this line print_r($data['view_pack']); it does not print // the table value.it prints.

/*
Array
(
[theme] => CI_DB_mysql_result Object
(
[conn_id] => Resource id #36
[result_id] => Resource id #60
[result_array] => Array
(
)

[result_object] => Array
(
)

[current_row] => 0
[num_rows] => 0
)

[destination] => CI_DB_mysql_result Object
(
[conn_id] => Resource id #36
[result_id] => Resource id #63
[result_array] => Array
(
)

[result_object] => Array
(
)

[current_row] => 0
[num_rows] => 0
)

)

*/

}


Messages In This Thread
get different tables data in different array index in a single method in a model - by El Forum - 10-31-2009, 04:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB