In this tutorial I’m going to show you how to create a simple crud application using Mongo DB and php. If you want to know how to install Mongo DB, visit the link below:
First you’re going to need to create a database configuration file which connects to your Mongo DB. Just like in MySQL, we also make use of a configuration file that we will just include on the files where we are going to need to query the database. This is to save time and avoid repeating of code.
<?php $conn = new Mongo(); $db = $conn->test; $collection = $db->people; ?>
Let me break down the code for you:
- $conn = new Mongo() – this initializes the Mongo DB class which contains all the methods which you can use to manipulate data in mongo DB through php.
- $db =…
View original post 1,005 more words