A parenthesis was left out of this example on the trim function. It should be:

SELECT *
FROM tblBooks
WHERE 1 = 1

<cfif Trim(FORM.authorOne) NEQ "">
    AND AuthorOne LIKE '%#FORM.authorOne#%
</cfif>

<cfif Trim(FORM.authorTwo) NEQ "">
    AND AuthorTwo LIKE '%#FORM.authorTwo#%'
</cfif>

-Greg
  ----- Original Message -----
  From: Adrian Lynch
  To: CF-Newbie
  Sent: Saturday, May 29, 2004 1:26 AM
  Subject: RE: SQL sytax not jiving with Coldfusion

  That's ok, try something like this...

  SELECT *
  FROM tblBooks
  WHERE 1 = 1

  <cfif Trim(FORM.authorOne NEQ "">
      AND AuthorOne LIKE '%#FORM.authorOne#%
  </cfif>

  <cfif Trim(FORM.authorTwo NEQ "">
      AND AuthorTwo LIKE '%#FORM.authorTwo#%'
  </cfif>

  .....
  .....
  .....

  Or do as you were with building up a where string.

  Ade
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to