MongoDB Part 3 : Simple Todo List with PHP and MongoDB

This tutorial help to understand mongodb connection functionality with php and find the result set from mongodb database to display in table grid results.This is beginner tutorial for mongodb and PHP.Mongodb is very popular nosql database and php is a very popular open source web scripting language.I am creating simple example to how to read data from mongodb database and parse data into php server side.

We will follow simple steps to connect php to mongodb database using Mongo php driver,Previously i have illustrated how to install mongodb and how to install mongodb driver in your xampp widnows server.


You can also check other tutorial of MongoDB and PHP,

Simple Listing Example of Mongodb with PHP

Step 1: We will start mongodb server using 'mongod' command,you can type 'mondod' in window command line enter.If you havnt install please refer previous tutorial

Step 2: We will create a index.php file data will contain connection string for mongodb with php and table listing html code to display records.

Step 3: Creating connection with mongodb and php using below code,Please put below code into top of the index.php file.

Step 4: Iterating on mongodb result set using for-each loop using below code,Please put below code in body section of the index.php file.


This will display simple listing of all mongo db records,You can add/edit record data using mongodb command line query.I left add,edit and delete functionality from UI side.You can do yourself.