note 115129 deleted from mongodb.getcollectionnames by derick

From: Date: Thu, 11 Sep 2014 11:54:08 +0000
Subject: note 115129 deleted from mongodb.getcollectionnames by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-200410@lists.php.net to get a copy of this message
Note Submitter: George Gombay ---- A small change to the earlier example will result in a more user-friendly output that will be easier on the eye: <?php $dbname = 'members'; // Previously created database $conn = new MongoClient("localhost"); $list = $conn->selectDB($dbname)->getCollectionNames(); foreach ($list as $coltion) { $colName = $coltion; echo '<p>Collection name is: <em>'; echo $colName; echo '.</em></p>'; } ?> This will produce an output similar to the following; Collection name is: addresses.

« previous php.notes (#200410) next »