PHP Simple Operation MongoDB Method (installation and additions and deletions to check) _php skills

Source: Internet
Author: User
Tags mongodb php mongodb

The example of this article describes the simple operation of Php MongoDB method. Share to everyone for your reference, specific as follows:

PHP operation MongoDB First download the MongoDB expansion pack from the Internet, https://github.com/mongodb/mongo-php-driver/downloads, select the corresponding expansion package.

This is my next, then decompression, VC6 fit apache,vc9 suitable for iis,ts (thread safe) refers to PHP as a modular form of operation.

Then put the Php_mongo.dll in PHP in the Ext folder, and then add Extension=php_mongo.dll in the php.ini, restart Apache.

The package for the PHP extension MongoDB is installed.

About query MongoDB Some use functions to query manuals http://us.php.net/manual/en/class.mongocollection.php

 <?php error_reporting (7); $conn = new Mongo (); $db = $conn->phpdatabase; $collectio
n = $db->phpcollection; /*-----------------------------* Delete *-----------------------------$collection->remove ("name" =>)
xixi111 ")); */*------------------------------*------------------------------for ($i = 0; $i <= $i + +) {$data = array ( "Name" => "Xixi". $i, "email" => "673048143_". $i. "
  @qq. com "," Age "=> $i *1+20);
$collection->insert ($data); * *////*-------------------------------* Find *-------------------------------$res = $collection->find (Array ("Age" =& Gt
Array (' $GT ' =>, ' $lt ' =>)), Array ("name" => true)); foreach ($res as $v) {print_r ($v);}//*-------------------------------* update *-------------------------------$coll
Ection->update (Array ("Age" =>22), Array (' $set ' => Array ("name" => "Demoxixi")); */?> 

More interested in PHP related content readers can view the site topics: "PHP+MONGODB Database Operation Skills Encyclopedia", "PHP based on PDO Operation Database Skills summary", "PHP object-oriented Program Design Introduction Tutorial", "PHP string (String) Usage Summary", " Introduction to PHP+MYSQL Database operations and a summary of PHP common database operations Tips

I hope this article will help you with the PHP program design.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.