Oops, forgot to add quotes:
> You can order by rand(), but it may be slow for large tables:
$select = $table->select()->limit(1)->order('rand()');
Take a look at this page for a faster way to fetch a random row:
http://www.paperplanes.de/2008/4/24/mysql_nonos_order_by_rand.html
--
Hector
On Wed, Aug 5, 2009 at 3:02 AM, Jacky Chen wrote:
> Hi there,
> if the Zend_Db_Table::fetchRow() always return the first row from the
> result is correct?
>
> because i want to fetch one row from the result set also by offset,such as
> this,
>
> // $table is an object of a class that extends Zend_Db_Table
>
> $select = $table->select()->limit(1, rand(0,100));
> $row = $table->fetchRow($select);
>
> but it always return the first row of the result set.
>
> how to solved that?
>
> Best Regards
> Jacky
>