...

View Full Version : cfm Query not working



tycoon
06-07-2005, 03:34 PM
Hi all..what i'm trying to a simple search function....there prolem is my result page(testsearch2.cfm) won't

display the result at all...well here my code..can anybody please comment

first page(testsearch1.cfm)

<html>
<head>
</head>
<body>
<form name="form1" method="post" action="testsearch2.cfm">
Search on
<select name="fieldname" id="fieldname">
<option value="full_name" selected>Employee Name</option>
<option value="emp_no">Employee No</option>
</select>
for
<input name="sitem" type="text" id="sitem">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>

second or result page(testsearch2.cfm)

<html>
<head>

<cfquery name="result" datasource="epa">
Select * from employee where "#Form.fieldname#"="#Form.sitem#"
</cfquery>
</head>

<body>
<cfoutput>#result.emp_no#</cfoutput>
</body>
</html>

nikkiH
06-08-2005, 03:15 PM
What do you mean by "won't display"?
Do you get an error? If so, what?
If you don't get an error, are you sure there really are matches? This query will be case-sensitive and does not do partial matching.

Noodles24
08-10-2005, 10:21 PM
Couple of small problems, don't know if it would have stopped it from working, but this should work:



<cfquery name="result" datasource="epa">
Select * from employee where #Form.fieldname#='#Form.sitem#'
</cfquery>

<cfoutput query="result">#result.emp_no#</cfoutput>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum