note 101005 modified in class.mongoregex by danbrown

From: Date: Fri, 19 Nov 2010 17:57:41 +0000
Subject: note 101005 modified in class.mongoregex by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174207@lists.php.net to get a copy of this message
First you must declare and define your regexObj Here I am looking for all entry of my database wich is like "%Nicolas%" and the /i param is used for Insensitive Case $regexObj = new MongoRegex("/^Nicolas/i"); <?php // I attach the regexObj to my Where Condition $where = array("ctname" => $regexObj); // Execute the request $resultset = $this->db->Infos->find($where); // Parsing the results while ($resultset->hasNext()) { $clientObj = $resultset->getNext(); echo "Client Name: ".$clientObj["cname"]."</br>"; } ?> --was-- // First you must declare and define your regexObj // Here I am looking for all entry of my database // wich is like "%Nicolas%" and the /i param // is used for Insensitive Case $regexObj = new MongoRegex("/^Nicolas/i"); // I attach the regexObj to my Where Condition $where = array("ctname" => $regexObj); // Execute the request $resultset = $this->db->Infos->find($where); // Parsing the results while ($resultset->hasNext()) { $clientObj = $resultset->getNext(); echo "Client Name: ".$clientObj["cname"]."</br>"; } http://php.net/manual/en/class.mongoregex.php

« previous php.notes (#174207) next »