php - dump real data from rethinkdb table

83

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?

183

Answer

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);
}

People are also looking for solutions to the problem: PHP script not found by Java but works in browser

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.