views:

79

answers:

4

I want to fetch intermediate rows from by database.

Like for last 10 rows i will use limit :

    return Doctrine_Query::create()
                ->select('v.*')
                ->from('Video v')                   
                ->where("v.community_id='$community_id' AND v.user_id='$user_id' AND v.published='$published'")
                ->orderBy('v.id DESC')
                ->limit(10)
                ->execute();        

but what if i want 110-120 rows?Can anybody tell me about that? how to write this kind of query in doctrine

+2  A: 

You could use a Doctrine_Pager

$page = 10;
$limit = 10;
$query = Doctrine_Query::create()
        ->select('t.*')
        ->from('SomeTable t')

$pager = new Doctrine_Pager(
    $query,
    $page,
    $limit
);

$rows = $pager->execute();
Marek Karbarz
+2  A: 

Use the offset() clause.

AJ
much easier than using the pager
Marek Karbarz
+1  A: 

For rows 110-120, you want

LIMIT 109, 10
Jenni
A: 

use offset clause...chk dis

piemesons