Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- try
- {
- $m = new Mongo(); // connect
- $db = $m->selectDB("local");
- }
- catch ( MongoConnectionException $e )
- {
- echo '<p>Couldn\'t connect to mongodb, is the "mongo" process running?</p>';
- exit();
- }
- $db->users->insert( array( pnome => $_REQUEST['pnome'],
- unome => $_REQUEST['unome'],
- sexo => $_REQUEST['sexo'],
- hacademicas => $_REQUEST['hacademicas']) );
- $collection = new MongoCollection($db, 'users');
- $cursor = $collection->find();
- foreach ($cursor as $doc)
- {
- echo "<pre>";
- var_dump($doc);
- echo "</pre>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment