Question

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

Was it helpful?

Solution 4

use offset clause...chk dis

OTHER TIPS

Use the offset() clause.

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();

For rows 110-120, you want

LIMIT 109, 10
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top