Your error is either being caused by #edad# not being "todas" or by #precio#
not being precio1 through precio4. Either way, the values that you are
passing in do not meet any conditions and therefore you have nothing between
your cfquery tags.
Since you have all of your cfif login INSIDE the cfquery, you do not leave
room for a variable not meeting any of the conditions. In other words, put
something around the cfquery to make sure that the value that you are
passing in is valid.
<cfif #edad# is "todas">
<CFQUERY NAME="resultado_busqueda" DATASOURCE="citascaracas">
<cfif #precio# is "precio1">
SELECT * FROM Masajista WHERE precio LTE "100"
<cfelseif #precio# is "precio2">
SELECT * FROM Masajista WHERE precio GT "100" and precio GTE "150"
<cfelseif #precio# is "precio3">
SELECT * FROM Masajista WHERE precio GT "150" and precio GTE "250"
<cfelseif #precio# is "precio4">
SELECT * FROM Masajista WHERE precio GT "250"
</cfif>
</CFQUERY>
</cfif>
Additionally, I like to leave myself an out (depending on the situation)
where I end a series of elseifs with a simple else to handle anything that
may be unexpected. For example, I don't know where #precio# is getting set,
but I prefer to do something like this (note the change in the cfelseif to a
cfelse):
<cfif #edad# is "todas">
<CFQUERY NAME="resultado_busqueda" DATASOURCE="citascaracas">
<cfif #precio# is "precio1">
SELECT * FROM Masajista WHERE precio LTE "100"
<cfelseif #precio# is "precio2">
SELECT * FROM Masajista WHERE precio GT "100" and precio GTE "150"
<cfelseif #precio# is "precio3">
SELECT * FROM Masajista WHERE precio GT "150" and precio GTE "250"
<cfelse>
SELECT * FROM Masajista WHERE precio GT "250"
</cfif>
</CFQUERY>
</cfif>
Good luck,
Jeremy
Hi everyone!
I would like to know what I´m doing wrong...
I try to get the following query using CF and Access...
<CFQUERY NAME="resultado_busqueda" DATASOURCE="citascaracas">
<cfif #edad# is "todas">
<cfif #precio# is "precio1">
SELECT * FROM Masajista WHERE precio LTE "100"
<cfelseif #precio# is "precio2">
SELECT * FROM Masajista WHERE precio GT "100" and precio GTE "150"
<cfelseif #precio# is "precio3">
SELECT * FROM Masajista WHERE precio GT "150" and precio GTE "250"
<cfelseif #precio# is "precio4">
SELECT * FROM Masajista WHERE precio GT "250"
</cfif>
</cfif>
</CFQUERY>
And I get the following error...
Error Diagnostic Information
ODBC Error Code = ()
Invalid SQL String ""
The error occurred while processing an element with a general identifier of
(CFQUERY), occupying document position (1:1) to (1:61).
I have the fiel precio in TEXT format, that is th reason of the ""...
Regards,
Javier
-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com
-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org