Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-07-2005, 03:34 PM   PM User | #1
tycoon
New Coder

 
Join Date: Apr 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
tycoon is an unknown quantity at this point
cfm Query not working

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>
tycoon is offline   Reply With Quote
Old 06-08-2005, 03:15 PM   PM User | #2
nikkiH
Senior Coder

 
nikkiH's Avatar
 
Join Date: Jun 2005
Location: Near Chicago, IL, USA
Posts: 1,973
Thanks: 1
Thanked 32 Times in 31 Posts
nikkiH is on a distinguished road
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.
__________________

If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit
http://www.kaelisspace.com/
nikkiH is offline   Reply With Quote
Old 08-10-2005, 10:21 PM   PM User | #3
Noodles24
Regular Coder

 
Join Date: Feb 2005
Location: UK
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Noodles24 is an unknown quantity at this point
Couple of small problems, don't know if it would have stopped it from working, but this should work:

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

<cfoutput query="result">#result.emp_no#</cfoutput>
__________________
Cooking Forum | Health Forums
Noodles24 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:38 PM.


Advertisement
Log in to turn off these ads.