php - F3 return query result -
i try build rest interface using fat free framework. use following code query database:
$product = new db\sql\mapper($this->db, 'product'); $product->load(array('id=?', $this->productid));
i can return instance title with
echo json_encode($product->title);
but how return whole row? following won't work
echo json_encode($product);
found it. had use
echo json_encode($product->cast());
Comments
Post a Comment