views:

335

answers:

1

Hi,

How do I check the number of records returned from a search of my MySQL database with a statement like this:

$searchKey = 'Something to search for'; 
$searchResults = Doctrine::getTable('TableName')->createQuery('t')- 
    >where('columnName LIKE ?','%'.$searchKey.'%')->execute(); 
+1  A: 

maybe

$searchResults->rowCount();

from here

Galen
+1 Thanks Galen. BTW, nice logo.
01010011
Just a side note : Doctrine Collection are implementing Iterator and ArrayAccess, so you can use count(), foreach() ... etc
DuoSRX