When any developer is working with any web application, he/she will constantly interact with the Select Query. As i am working with CakePHP, i also need to use Select Query often. For Select Query in CakePHP, you can use find method of Model which gives you the data as per conditions given in find method. If you write more than one conditions in conditions array passed in find method than by default it will take OR clause and make a query string with "AND". If you want to do OR operation or any other operation than you need to mention that in find method. Look at below syntax.
$this->Post->find('all', array('conditions' => $conditions));
$conditions = array("id"=>"5","name"=>"abc");
//Above condition will make a select query with AND.(WHERE id=5 AND name='abc')
$conditions = array("OR"=>array("id"=>"5","name"=>"abc"));
// If you define "OR" as per above statement than the query will be WHERE id=5 OR name='abc'
I am PHP Freelancer, Rakshit Patel AKA WordPress Freelancer working as PHP Programmer India. I am here to share all my developing knowledge, quick coding techniques, quick solutions to save your time and help you guys for any issue or bug fixing. If you have any PHP, WordPress, Magento related work, please contact me. I am interested for the work.