If you want pagination, then I would avoid QofQ - ...
# cfml-beginners
a
If you want pagination, then I would avoid QofQ - in fact I'd recommend never using QofQ there are likely better options. Databases are designed for things like pagination so seems appropriate to use the database to do the work. As a second point, but a very important one is to never trust user input. This:
LIMIT #form.length# offset #form.start#
is wide open to SQL injection attacks. You must defend against hackers. A simple
cfqueryparam
(if your db supports bindings in the LIMIT clause) or even a
val(form.length)
would be a good start.
2
g
yes, i did changed it, i rewrote it again to remove QoQ
👍 2
d
@gsr this is straight from my code base for the simplest of search queries using stored procedures, but the query can easily be done in a
<cfquery>
tag instead. Sql Example of Pagination https://trycf.com/gist/b9ab71ddd580859dc13fa5aff2e32dde/lucee5?theme=monokai