I created in my model the const getbypage:
const getByPage = (page = 1, limit = 10) => {
return executeQuery(
'select * from clientes limit ? offset = ?',
[limit, (page-1) * limit]
);
}
in the controller:
router.get('/', async (req, res) => {
try {
const clients = await getByPage();
res.render('clients/list', { arrClients: clients });
} catch (err) {
console.log(err);
}
});
and the error is:
code: 'ER_PARSE_ERROR', errno: 1064, sqlState: '42000', sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 0' at line 1", sql: 'select * from clientes limit 10 offset = 0' } GET /clients - - ms - -
CAN SOMEBODY HELP ME?