install mongo client

How to connect MongoDB using PHP

After posting content about MongoDB, just thinking of posting another content about MongoDB but with PHP. Yes this post about connecting MongoDB with PHP,  if your are using Windows OS you can check with below link about MongoDB installations & enable extension in Wamp Server.

Before starting up our tutorial let’s check MongoDB is running status by executing simple script to check in PHP.

MongoClient is used to create and manage the connections between PHP and MongoDB.

$con = new MongoClient( "mongodb://" );

Let’s  create simple  feedback form to add and show the data from MongoDB. first create demo database.  You no need to create collection because when you do the first insert collection will automatically created and insert the data into it. Continue reading…