

![test1.php <?php require_once 'connection.php'; $query = new MongoDBDriverQuery([]); $rows = $client->executeQuery("flori.flowers", $query); ?> <ul> <?php foreach($rows as $key=>$val):?> <li><?php var_dump($val);?></li> <?php endforeach; ?> </ul>](https://image.slidesharecdn.com/4-190422095151/75/4-Php-MongoDB-view_data-3-2048.jpg)
![test2 <?php require_once 'connection.php'; $query = new MongoDBDriverQuery([]); $rows = $client->executeQuery("flori.flowers", $query); ?> <?php foreach($rows as $val):?> <?php if(isset($val->nume)):?> <li><?php echo $val->nume;?></li> <?php endif;?> <?php endforeach; ?>](https://image.slidesharecdn.com/4-190422095151/75/4-Php-MongoDB-view_data-4-2048.jpg)
![index.php <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php require_once 'connection.php'; $query = new MongoDBDriverQuery([]); $rows = $client->executeQuery("flori.flowers", $query); ?> <table> <tr> <td>Nume</td> <td>Culoare</td> <td>Marime</td> <td>Pret</td> </tr>](https://image.slidesharecdn.com/4-190422095151/75/4-Php-MongoDB-view_data-5-2048.jpg)

This document contains code snippets demonstrating connecting to a MongoDB database and executing queries to retrieve and display document data. test1.php connects to the database and executes a query, then dumps the returned documents. test2.php executes the same query and displays the 'nume' field value of each document. index.php connects, queries for documents, and displays the 'nume', 'culoare', 'marime', and 'pret' fields in a table if those fields are set and not empty.