phprethinkdbrethinkdb-javascript

dump real data from rethinkdb table


I'm using the recommended PHP client driver for rethinkdb and I created a database and also a table unto that database, now I'm trying to retrieved all the documents from the specific table from a newly created database by

$conn = r\connect('localhost');
$res = r\db("queapp_db")->table("cities_and_states")->run($conn);
echo '<pre>';
print_r($res);

but it gives me this

enter image description here

I can't verify from the return results if my expected data was returned or not due to simply the return output seems not like of my expected results. Any help ideas on how to display the records that I inserted?


Solution

  • The $res in your code is a cursor object, you need to iterate to get the documents inside:

    foreach ($res as $doc) {
        print_r($doc);
    }