Solved

Get Query Data

Posted on 2008-10-24
10
184 Views
Last Modified: 2013-12-24
I have the following results from a query;

getstats - query - Top 3 of 3 Rows
           CNO      ID            IID         STAT_FIRST1      STAT_LEVEL1      STAT_LAST1
1       101003       1073    R1232                   W                       5                        CLINE
2       101003       1093    R7653                    J                               4                        JONES
3       101003       1152    R7812                    A                       4                        SMITH

I am learning so please bear with me.
If I need to populate a form how do I get the values. For example if I need to retrieve the  STAT_FIRST1,      STAT_LEVEL1 and  STAT_LAST1 from the second row, how would I do this without running another query?
0
Comment
Question by:usky1
  • 5
  • 5
10 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22798876
in order to do this you do the following
In order to get the second record just say in your query where id=1093    
<cfoutput query="getstats ">
<input type="text" name="fieldname" value="#STAT_FIRST1#"
</cfoutput>
0
 

Author Comment

by:usky1
ID: 22798940
In the getstats query I need to query all the information for use later.
Is there any way that I can get the information without doing another query or query of queries?
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22798982
try is
<cfoutput query="getstats ">
<cfif getstats.recordcount  eq 2>
<input type="text" name="fieldname" value="#STAT_FIRST1#">
<cfif>
</cfoutput>
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:usky1
ID: 22799050
The getstats.recordcount is just giving me the total number of records and displaying two values for row 1 and for row 2.
0
 
LVL 19

Accepted Solution

by:
erikTsomik earned 500 total points
ID: 22799680
then try this
<cfoutput query="getstats ">

<input type="text" name="fieldname" <cfif currentrow eq 2>value="#STAT_FIRST1#"</cfif>>

</cfoutput>
0
 

Author Comment

by:usky1
ID: 22799923
The value was properly selected but it still produced two input fields, one with the correct value and one with an empty value.
 I changed the input to,
<cfif currentrow eq 2>
<input type="text" name="fieldname" <cfif currentrow eq 2>value="#STAT_FIRST1#"</cfif>>
</cfif>
And it is working now.
But is this a clean way to do what I need to?
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22800055
if you only need this you can just say in the query where id= to whatever number , IN this case you would not have to do this . However, is this always gonna look at the second row or it just a project specific

0
 

Author Comment

by:usky1
ID: 22800767
Sometimes it might need to look another row.
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22801433
then this condition is fine
0
 

Author Closing Comment

by:usky1
ID: 31509759
Thank you for your help.
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question