Solved

Get Query Data

Posted on 2008-10-24
10
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 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