cakephp find

CakePHP find and the SELECT BETWEEN query syntax

In an effort to get more CakePHP find query examples out into the world, here are two examples of how to perform SQL "SELECT BETWEEN" queries using the CakePHP find method.

In my first find query example, I'm trying to find all the records from the logfile_records database table where the date column is between the two dates specified:

A CakePHP debug strategy

I just started working with CakePHP in the last two weeks, and as a newbie, I've found a simple debug strategy that I like. I've used this CakePHP debug technique several times when trying to formulate a CakePHP find query.

CakePHP find - a SQL limit query example (SQL select with limit clause)

When working with CakePHP, one of the hardest things for me has been getting used to formulating SQL queries with the CakePHP find method syntax. Today I needed to run a SQL query where I limited the amount of records returned from the database, and after a little trial and error, I found the correct CakePHP SQL LIMIT syntax, and thought I'd share that here today.

CakePHP find distinct - SELECT DISTINCT syntax for the CakePHP find method

As a CakePHP newbie, I'm spending a lot of time learning how to formulate SQL queries with the CakePHP find function syntax. This morning I need to create a "select distinct" SQL query in CakePHP. Fortunately this wasn't too hard once I figured out how to piece it all together.

In my case, I have a database table named logfile_records, and I wanted to run a SQL "select distinct" query against that table. If I was going to write the query in plain SQL I'd write it like this: