Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

how paginate my query result???


Reply


3 Posts   1211 Views

Avatar
bebabeba

Community Member, 193 Posts

17 February 2009 at 4:20am

Edited: 17/02/2009 4:20am

Hi!
please helm me..I read guide about search form and I see how paginate serch result http://doc.silverstripe.org/doku.php?id=tutorial:4-site-search
Now I have a function Conn() that take data from external database (243). I need show 10 result for page. Function that count page number work good (25 pages), but all my data(243) are show in all 25 pages, so they aren't sort in my 25 pages.

this is my function:

function Conn()
   {    global $db_pandora;
    $record=$db_pandora->query('SELECT * FROM mm_ville');
   
    $rec=array();
   
while($rec[]=$record->nextRecord())
{
   
}
$doSet = new DataObjectSet();
foreach($rec as $key)
{
          
$record = array(
'Id' => $key['id'],
'Nome' => $key['name'],
);
$doSet->push(new ArrayData($record));

}
return $doSet;
   }
   

Avatar
bebabeba

Community Member, 193 Posts

23 February 2009 at 8:43pm

any one?I'm in trouble..

Avatar
tesh

Community Member, 1 Post

21 March 2009 at 1:05am

Have you had a look at this - http://doc.silverstripe.com/doku.php?id=private:recipes:pagination