Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional statement returning an error

Status
Not open for further replies.

cconlin

Technical User
May 7, 2002
3
US
Hello,

The following code is throwing an error:

Code:
<!--- Check to see if the user is adding a new client --->
<CFIF  IsDefined(&quot;FORM.ProjectName&quot;)>

<!--- Create array of form results --->
<CFSET NewClient=ArrayNew(2)>
<CFSET NewClient[1][1]=FORM.CompanyName>	
<CFSET NewClient[1][2]=FORM.ProjectName>
<CFSET NewClient[2][1]=FORM.Username>	
<CFSET NewClient[2][2]=FORM.ClientPassword>

<CFQUERY NAME=&quot;Match&quot; DATASOURCE=&quot;skillsdb&quot; USERNAME=&quot;****&quot; PASSWORD=&quot;******&quot;>
SELECT	Company,Username,Password
FROM 	Clients
WHERE	Username='#NewClient[2][1]#'
</CFQUERY>

</CFIF>

<!--- Check if username already exists --->
	<CFIF Match.RecordCount GREATER THAN 0>

The error is:

Error Occurred While Processing Request
Error Diagnostic Information

An error occurred while evaluating the expression:


Match.RecordCount GREATER THAN 0



Error near line 23, column 25.

Error resolving parameter MATCH.RECORDCOUNT


ColdFusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either:

You have misspelled the parameter name, or
You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.


The error occurred while processing an element with a general identifier of (CFIF), occupying document position (23:2) to (23:40).

Is there something wrong involving the conditional statement? Or is it my reference to the database query &quot;Match&quot;? Thanks in advance!

Chris


 
if the form field is not defined, you don't run the query, but then you test the record count anyway, so just move that CFIF inside the other one

rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top