I am using php waveframework and when I look at the results from:
http://localhost/json.api?www-command=class-methode
I get an empty page,
but when I use:
http://localhost/xml.api?www-command=class-methode
I see the espected results.
I thought that the framework gave both the results?
I can not find the difference in the help files.
If I use the
&www-return-type=json
it still gives me an empty page, but it gives me the right result when I
use: &www-return-type=xml
Is there a variable that needs to be set?
The client who will be using the service needs the results in json format.
This is the model:
public function alle_landen(){
$rows = array(); $Aantal = 0; $connect = odbc_connect($this->dsn_Name, $this->dsn_UserName, $this->dsn_Pass); # query the table $query = "SELECT CDLAND, OMSCHR FROM LAND"; # perform the query $result = odbc_exec($connect, $query); # fetch the data from the database while($myRow = odbc_fetch_array( $result )){ $Aantal += 1; $rows[] = $myRow; } # close the connection odbc_close($connect); if($rows){ // Returning entries and the total row count return array('entries'=>$rows,'total'=>$Aantal); } else { // Returning empty data return array('entries'=>array(),'total'=>0); } }
and this is the controller:
public function allelanden(){
// Loading the model and data to the model $data = $this->getModel('landen'); $data = $data->alle_landen(); if($data){ return $this->resultTrue('Request complete', $data); } else { return $this->resultFalse('Search failed'); } }
Thanks in advance,
Brian
No comments:
Post a Comment