Question
Limit line in select query throwing error after working for 2 years+
I assume the webhost updated their Coldfusion software ( was
CF7 ) which caused this error to start to occur, but I can't figure
out what is wrong with the code below.
The error says the Limit line is the problem, looks like it's putting single quotes around the first number in the limit line for some reason, but I can't prevent this from happening even with Int().
FWIW, the limit line that worked forever was LIMIT #page*10#,10 I just tried updating it to what is below today to fix it. The error says this:
Error Executing Database Query.
Syntax error or access violation: 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',10' at line 10
212 : )
213 : ORDER BY pPartNumber
214 : LIMIT <cfqueryparam cfsqltype="int" value="#Int(page*10)#">,10
215 : </cfquery>
216 :
SQL select distinct * from products where pActive = 1 AND ( pName LIKE (param 1) OR pDescription LIKE (param 2) OR pPartNumber LIKE (param 3) ) ORDER BY pPartNumber LIMIT (param 4) ,10
DATASOURCE dsn
VENDORERRORCODE 1064
SQLSTATE 42000
Resources:
Any help is greatly appreciated, Thanks!
The error says the Limit line is the problem, looks like it's putting single quotes around the first number in the limit line for some reason, but I can't prevent this from happening even with Int().
FWIW, the limit line that worked forever was LIMIT #page*10#,10 I just tried updating it to what is below today to fix it. The error says this:
Error Executing Database Query.
Syntax error or access violation: 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',10' at line 10
212 : )
213 : ORDER BY pPartNumber
214 : LIMIT <cfqueryparam cfsqltype="int" value="#Int(page*10)#">,10
215 : </cfquery>
216 :
SQL select distinct * from products where pActive = 1 AND ( pName LIKE (param 1) OR pDescription LIKE (param 2) OR pPartNumber LIKE (param 3) ) ORDER BY pPartNumber LIMIT (param 4) ,10
DATASOURCE dsn
VENDORERRORCODE 1064
SQLSTATE 42000
Resources:
Any help is greatly appreciated, Thanks!
