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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 31st, 2004, 08:36 PM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Help with 2D arrays

I haven't long been working with arrays, and I'm wondering just how to accomplish the following....First off, here's what I have so far (using fuseQ)...

in act_pricelists.cfm

<cfscript>
commonplist = ArrayNew( 2 );
commonplist[1][1] = 'Brother Dealer';
commonplist[1][2] = 'http://www.brother.com/';
commonplist[2][1] = 'Brother Solutions';
commonplist[2][2] = 'http://www.brothersolutions.com/';
</cfscript>

This outputs fine in dsp_pricelists.cfm

<cfoutput>
<cfloop from = "1" to="#ArrayLen( commonplist )#" index="aRow" >
<cfloop from = "1" to="#ArrayLen( commonplist[1] )#" index="aCol" >
#commonplist[aRow][aCol]#
</cfloop>
<br />
</cfloop>
</cfoutput>

and this is all fine, with the output looking something like...

Brother Dealer http://www.brother.com/
Brother Solutions http://www.brothersolutions.com/

But what I want is the 2nd element of the array to be used as the url.

E.G. in dsp_pricelists.cfm I would like to see
<a href="http://www.brother.com/">Brother Dealer</a>
<a href="http://www.brothersolutions.com/">Brother Solutions</a>

or even

Brother Dealer <a href="http://www.brother.com/">URL</a>
Brother Solutions <a href="http://www.brothersolutions.com/">URL</a>


Is this possible??
-----------------------------------------------

All help appreciated
TIA
MarkH

Reply With Quote
  #2  
Old August 31st, 2004, 08:42 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 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 10 h 8 m 55 sec
Reputation Power: 53
I'm sure it is possible using the arrays. But I think that using a structure would make this so much easier?

Code:
<cfscript>
commonplist = ArrayNew( 1 );
commonplist[1] = structNew();
commonplist[1].name = 'Brother Dealer';
commonplist[1].url = 'http://www.brother.com/';
commonplist[2] = structNew();
commonplist[2].name = 'Brother Solutions';
commonplist[2].url = 'http://www.brothersolutions.com/';
</cfscript>

<cfoutput>
<cfloop from = "1" to="#ArrayLen( commonplist )#" index="thisRow" >
<a href="#commonplist[thisRow].url#">#commonplist[thisRow].name#</a>
</cfloop>
</cfoutput>
__________________
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 August 31st, 2004, 08:48 PM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I tinkered with the idea of structures for a start but since I'd just completed a tutorial on arrays I guess I had been blinded to the requirements of job...

thanks once again Kiteless!

Reply With Quote
  #4  
Old September 17th, 2004, 02:28 PM
johnbuch johnbuch is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 johnbuch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
how to save query values into a session

How can i move the query results into an array into sessions, so that i want to those on the later page.

Reply With Quote
  #5  
Old September 20th, 2004, 05:54 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 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 10 h 8 m 55 sec
Reputation Power: 53
You can simply do:

<cfquery name="session.myQuery">
...
</cfquery>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Help with 2D arrays


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 6 hosted by Hostway