EnglishSvenska

This post is automatically translated to English by Google Translate.

Using regular expressions in CakePHP and MySQL

If you want to find something in the database using regular expressions:

$domainNamed = $this->DomainName->find('all', array(
'conditions' => array(
'name REGEXP "^www.i"'
),
'fields' => array(
'name'
),
'contain' => false,
'limit' => 10
));

The code above will find all domain names that start with "www.".

Posted in CakePHP

Leave a Reply

Your email address will not be published. Required fields are marked *

*