I am a beginner PHP. I want to paging the results retured from TSql as follow:
public function index()
{
$conn = ConnectionManager::get(‘default’);
$stmt = $conn->execute(‘SELECT
b.BANCHI,
b.ONAMAEKANASEI,
a.NYUUKINBI,
a.KINNGAKU,
1 As STATUS,
a.SAIGOHENKOUNICHIJI
FROM Nyuukins a
INNER JOIN Seitos b ON a.SEITOCODE = b.SEITOCODE
ORDER BY a.NYUUKINCODE’);
$results = $stmt ->fetchAll('assoc');
$this->paginate = [
'contain' => [$results],
'limit' => 25,
'order' => [
'NYUUKINCODE' => 'asc'
]
];
$nyuukins = $this->paginate($results);
$this->set(compact('nyuukins'));
$this->set('_serialize', ['nyuukins']);
}
I got an error from browser: Unable to locate an object compatible with paginate.