3

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});

Undecided Dev
  • 840
  • 6
  • 16

1 Answers1

7

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"}});
CfSimplicity
  • 2,338
  • 15
  • 17