How to use limit() function in Mongodb

This query will get all documents that contain MID = “53c6bfbc1ee2f2ed0acb1f0a”, don’t include 2 fields “Cap” and “Type” $pID = “53c6bfbc1ee2f2ed0acb1f0a”; $cursor = $collection->find(array(‘MID’=>$pID), array(“Cap”=>0, “Type”=>0)); If you wish to limit only 2 documents returned instead of 2000. You can use either 1 of these method below: $pID = “53c6bfbc1ee2f2ed0acb1f0a”; $cursor = $collection->find(array(‘MID’=>$pID), array(“Cap”=>0, “Type”=>0))->limit(2); Or $cursor = $collection->find(array(‘MID’=>$pID), array(“Cap”=>0, “Type”=>0)); $cursor->limit(2);

Continue reading »

Install MongoDB and config to work with PHP

Step 1: Go to mongodb.org to download the version that works for your OS. Don’t download to C:\Program Files\ directory because MongoDB doesn’t recognize space in the path. You may want to install under C:\ directory Step 2: Go to PECL to download the MongoDB driver for PHP version that runs on your OS (https://s3.amazonaws.com/drivers.mongodb.org/php/index.html) Step 3: Open php.ini, add some config options for mongodb as follow [mongodb] mongo.allow_empty_keys =0 mongo.allow_persistent = 1 mongo.chunk_size =262144 mongo.cmd = “$” mongo.default_host = “localhost” mongo.default_port = 27017 mongo.is_master_interval…

Continue reading »

Setting up MySQL replication in V5.6.17

Setting up MySQL replication In this article the Master is 210.126.187.015 and the Slave is 210.126.187.016 On the Master, edit /etc/mysql/my.cnf (my.ini in Windows): 1) server-id = 126187015 # choose a unique integer 2) log_bin = /var/log/mysql/mysql-bin.log 3) bind-address = 0.0.0.0 # listen on all interfaces (by default 127.0.0.1 is used) 4) binlog_do_db = mydb # replicate only the ‘mydb’ database On Windows environment: 1) server-id = 127001 # choose a unique integer 2) log_bin = C:/Documents and Settings/JohnDoe/My Documents/Application Data/MySQL/MySQL56/mysql-bin.log 3) bind-address = 0.0.0.0…

Continue reading »

Modify Contact Us page in Zen-Cart

If you want to modify copy/text on this page, it’s very simple. Just go to YOUR-TEMPLATE directory under language dir to modify the way you want. includes/languages/english/html_includes/YOUR_TEMPLATE/define_contact_us.php However, if you plan to modify the form significantly, you’d look to spend more time to add codes in order to process the form. There’ll be multiple files you’ll have to open to modify in a PHP Editor such as EClipse or NuSphere client software. You can also add more php files and use require_once function to includes…

Continue reading »

Which Hosting Server you want to choose?

Having worked on so many customers’ projects on many different hosting servers, I realize that I need to write this article to help some of you who need to choose a hosting provider for your private or business website. I have the most experience with 1and1, BlueHost, Yahoo, and GoDaddy. I’m just saying from my experience using their Admin Control Panel, I’m not trying to advertise for any of these companies or whatsoever. If you don’t like what I say, too bad. Go figure it…

Continue reading »