How do I do this:
SELECT t.id FROM table t JOIN (SELECT(FLOOR(max(id) * rand())) AS maxid FROM table) AS tt ON t.id >= tt.maxid LIMIT 1
$connection = Doctrine_Manager::getConnection()->getDbh();
won't work... Try this:
$connection = Doctrine_Manager::getInstance()->getCurrentConnection()->getDbh();
Then:
$stmt = $connection->query('SELECT * FROM some_table'); $stmt->execute(); $result = $stmt->fetchAll();