I am managing a project in Kohana 2.3.4 where I need to create an API for my android backend. What I am doing is send a query on my model which returns $result
.
$query = "select product.deal_id,product.deal_key,p..."
$result = $this->db->query($query);
I am not sure if $result
is an Object or and array This consists of 4 rows and 8 columns. I need to change $result to json format. I am currently doing this by echoing.
echo json_encode($result);
This return an empty json {}
.
I am able to use the same query on my view by iterating through the $result
foreach ($result as $h){
echo $h->main_key;
}
Am I doing this right or is it that my $result
on this connection has no rows?