ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 7th, 2005, 09:44 AM
tycoon tycoon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 50 tycoon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 21 m 51 sec
Reputation Power: 5
Question 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

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>

Reply With Quote
  #2  
Old June 7th, 2005, 09:53 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,681 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 22 m 41 sec
Reputation Power: 53
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

Reply With Quote
  #3  
Old June 8th, 2005, 05:27 AM
tycoon tycoon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 50 tycoon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 21 m 51 sec
Reputation Power: 5
thanx

Reply With Quote
  #4  
Old June 8th, 2005, 07:11 PM
jdang jdang is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: OC, CA
Posts: 49 jdang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 15 m
Reputation Power: 4
did it work yet? it looks like you're missing <cfoutput> in front of your SQL statement, the variables won't get parsed

Reply With Quote
  #5  
Old June 8th, 2005, 08:59 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,681 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 22 m 41 sec
Reputation Power: 53
No CF will automatically evaluate any variables inside a cfquery block. You don't need to wrap it in cfoutput.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Query not working


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT