Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Basic model::find() question

I am new to Phalconphp and trying to build a simple API.
I have a very basic issue....I am trying to retrive data from the database (around 7000 records).

when I set a limit of 50 records works; however, when i increase the limit to 100 or even remove the limit it does not work. Help!

///So this is my code that works..
public function listAction()
$users = Users::find( [ "limit" => 50 , "columns" => 'user_id, name'] )->toArray();
echo json_encode($users);

/// and this is my code  return nothing.

public function listAction()
$users = Users::find( [ "limit" => 100 , "columns" => 'user_id, name'] )->toArray();
echo json_encode($users);

Is there a configuration in Phalcon that is afecting this query?

In the second query, how many users you get? echo count($users);

edited Apr '15

Hola Oscar, if i remove the limit I get 8684 (the full table). If i add a limt of 100 I get 100 as response. I did notice that when i change limit from 63 to 64 is when stops working.

Also noticed that I want just one coum "name" i am able to get 193 records; once i put limit to 194 stops working again.

and by the way...I am using Windows and Xampp.

I managed to narrow down the problem to json_encode($users). if i do print_r( $users ); i can see the content

edited Apr '15

Even this doesnt work with a lmit of 40..but it does work wit a limit of 30

    public function indexAction()
        $users = Users::find( ["limit" => 40 , "columns" => 'user_id, name, email, address, country'] )->toArray();

        $response = new \Phalcon\Http\Response();
        $response->setJsonContent( $users );
        //echo count($users);
        //print_r( $users );
        //print json_encode($users);

Are you retrieving UTF-8 data? Enabling error reporting ini_set("display_errors", 1); error_reporting(E_ALL); are there any errors?


Found the issue...It seems that that the json doesnt like some caracters in the database..