简体   繁体   中英

Parameters on LIMIT and OFFSET not working

Im trying to implement pagination by parameterized my limit from request URL unfortunately I'm having error.

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 ''25'' at line 1

Here is the code for sql syntax. Need your help badly. queryExecute("SELECT * FROM TABLE_NAME LIMIT:limit",{limit:rc.limit});

The limit parameter is being passed as a string by default, whereas the database requires an integer value. Try specifying the type:

 queryExecute("SELECT * FROM TABLE_NAME LIMIT:limit",{limit:{value:rc.limit,sqltype:"integer"}});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM