|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 Code:
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>
Code:
second or result page(testsearch2.cfm) <html> <head> <code><cfquery name="result" datasource="epa"> Select * from employee where "#Form.fieldname#"="#Form.sitem#" </cfquery> </head> <body> <cfoutput>#result.emp_no#</cfoutput> </body> </html> |
|
#2
|
|||
|
|||
|
Select * from employee where #Form.fieldname#='#Form.sitem#'
Always look at the debugging info where you can see the actual executed SQL statement, which would probably have given you a better idea of what the problem was.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
thanx
|
|
#4
|
|||
|
|||
|
did it work yet? it looks like you're missing <cfoutput> in front of your SQL statement, the variables won't get parsed
|
|
#5
|
|||
|
|||
|
No CF will automatically evaluate any variables inside a cfquery block. You don't need to wrap it in cfoutput.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Query not working |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|