Saturday, 19 October 2013

How to Connect MongoDB For PHP Application ?

// PHP code here

  1. <?php
  2.  
  3. $dbhost ='localhost';
  4.  
  5. $dbname='test';
  6.  
  7. $m=new Mongo("mongodb://$dbhost");
  8.  
  9. $db=$m->$dbname;
  10.  
  11. $collection=$db->shows;
  12.  
  13. $cursor = $collection->find();
  14.  
  15. ?>

No comments:

Post a Comment