Skip to main content

Posts

Showing posts from February, 2014

JSON : Tutorial and Usage

Json Introduction What is JSON? JSON stands for J ava S cript O bject N otation JSON is lightweight text-data interchange format JSON is language independent * JSON is "self-describing" and easy to understand JSON uses JavaScript syntax for describing data objects, but JSON is still language and platform independent. JSON parsers and JSON libraries exists for many different programming languages. Json Format Example : {     "employees": [         {             "firstName": "John",             "lastName": "Doe"         },         {             "firstName": "Anna",             "lastName": "Smith"         }     ] } Why JSON? For AJAX applications, JSON is faster and easier than XML: Using XML Fetch an XML document Use the XML DOM to loop through the document Extract values and store in variables Using JSON

MongoDB with PHP – Configuration and Examples

So, in previous posts, we have seen What is MongoDB and how we can perform CRUD operation on MongoDB .  So, moving ahead, lets learn how to use MongoDB with PHP.  By default, PHP assumes you will be using MySQL, so till now it doesn’t support MongoDB. But we can add the Mongo DB support to our existing PHP. On Windows https://s3.amazonaws.com/drivers.mongodb.org/php/index.html Go to the link, download the suitable version of zip. This zip contains the dll for mongo you will be using. Just unzip the zip file, and select the appropriate version of the dll(for ex, if you are using php 5.3.13 and you have downloaded the php_mongo-1.4.5.zip   , on 32-bit systems, you needs to use the php_mongo-1.4.5-5.3-vc9.dll from the zip.   So select the appropriate version as per 32/ 64 bit and your PHP version. Then just rename the dll file to php_mongo.dll and paste it to your php extensions directory.( ext by default). Then open your php.ini file, add the line   ex