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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

how paginate my query result???


Go to End


3 Posts   2256 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