Adobe Dreamweaver Forums



Last 10 THreads :         Trouble with SQL Query Tool on Leopard (Last Post : Daverms - Replies : 5 - Views : 6 )           »          Spry Accordion (Last Post : Ken Ford - *ACE* - Replies : 3 - Views : 8 )           »          Event listener (Last Post : NedWebs - Replies : 1 - Views : 2 )           »          action script for button (Last Post : melanro - Replies : 4 - Views : 10 )           »          Problems with variables (Last Post : Rob Dillon - Replies : 1 - Views : 2 )           »          Sefl-signed ssl certificate not possible? (Last Post : sysfor - Replies : 2 - Views : 8 )           »          Adding database RDS Login Dreamweaver 8 Coldfusion 8 (Last Post : Daverms - Replies : 3 - Views : 5 )           »          set width of adv. datagrid according to image width. (Last Post : Devsachin - Replies : 0 - Views : 1 )           »          Dreamweaver cs4 (Last Post : Murray *ACE* - Replies : 9 - Views : 10 )           »          Centering a site using layers in browser window (Last Post : Murray *ACE* - Replies : 3 - Views : 4 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Cold Fusion
 
Tags:



Reply
  #1 (permalink)  
Old 10-09-2008, 07:22 PM
PopcornCoder
 
Posts: n/a
Diggs:
Default Array issue

What's the problem with my array code attached, figure they have been around
for so many years I should probably learn how to use them.

<cfset my2darray=arraynew(2)>
<cfset my2darrry[1][1] = "Catalog Title">
<cfset my2darrry[1][2] = "Catalog Image">
<cfset my2darrry[1][3] = "Catalog Text">
<cfset my2darrry[1][4] = "Catalog Link">
<cfset my2darrry[2][1] = "Video Title">
<cfset my2darrry[2][2] = "Video Image">
<cfset my2darrry[2][3] = "Catalog Text">
<cfset my2darrry[2][4] = "Catalog Link">

<p>The values in my2darray are currently:</p>

<cfoutput>
#my2darray[1][1]#<br>
#my2darray[1][2]#<br>
#my2darray[1][3]#<br>
#my2darray[1][4]#<br>
#my2darray[2][1]#<br>
#my2darray[2][2]#<br>
#my2darray[2][3]#<br>
#my2darray[2][4]#<br>
</cfoutput>



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-09-2008, 07:22 PM
Adam Cameron
 
Posts: n/a
Diggs:
Default Re: Array issue

> <cfset my2darray=arraynew(2)>
> <cfset my2darrry[1][1] = "Catalog Title">


You might want to look closer at your code.

Also, when you have a problem, it's helpful if you tell us what the problem
actually is, not simply say "I have a problem, what is it?".

Thirdly: an array is really not the best data structure for you to be using
here. It looks more like it should be a struct, or perhaps an array of
structures to me.

--
Adam
Reply With Quote
  #3 (permalink)  
Old 10-09-2008, 07:51 PM
PopcornCoder
 
Posts: n/a
Diggs:
Default Re: Array issue

Please advise what is the problem with my code?
Reply With Quote


  #4 (permalink)  
Old 10-09-2008, 07:52 PM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: Array issue

Adam Cameron wrote:
>> <cfset my2darray=arraynew(2)>
>> <cfset my2darrry[1][1] = "Catalog Title">

>
> You might want to look closer at your code.
>
> Also, when you have a problem, it's helpful if you tell us what the problem
> actually is, not simply say "I have a problem, what is it?".


Really!!! because even with Adam point out the spot I could not see the
problem the first four times I looked at it. Since I did not really
know for what I was looking. Knowing the error would have guided me
much faster to this issue.

>
> Thirdly: an array is really not the best data structure for you to be using
> here. It looks more like it should be a struct, or perhaps an array of
> structures to me.
>


A valid point, but that sure looks like a foobar|hello world example to
practice a new skill and as such is fine. But I agree, if I where
looking at a requirement like this I would probably be looking at using
a structure, aka a hash array. I.E. using strings as index keys rather
then integers.


Reply With Quote
  #5 (permalink)  
Old 10-09-2008, 07:52 PM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: Array issue

PopcornCoder wrote:
> Please advise what is the problem with my code?


What is the error you are getting.
Reply With Quote
  #6 (permalink)  
Old 10-09-2008, 08:04 PM
Adam Cameron
 
Posts: n/a
Diggs:
Default Re: Array issue

>> <cfset my2darray=arraynew(2)>
>> <cfset my2darrry[1][1] = "Catalog Title">


> Please advise what is the problem with my code?


I think the problem is that you're not actually looking at it, as much as
anything else.

*look at it*.

--
Adam
Reply With Quote


  #7 (permalink)  
Old 10-09-2008, 08:30 PM
PopcornCoder
 
Posts: n/a
Diggs:
Default Re: Array issue

No I was asking you told me to look at my code closely and I was wondering what problem you saw with it as I am unfamilar with arrays and was asking for help.
Reply With Quote
  #8 (permalink)  
Old 10-09-2008, 08:40 PM
Adam Cameron
 
Posts: n/a
Diggs:
Default Re: Array issue

> No I was asking you told me to look at my code closely and I was wondering what problem you saw with it as I am unfamilar with arrays and was asking for help.

For goodness sake, mate.

What's the name of the variable in this line of code:
<cfset my2darray=arraynew(2)>

And what's the name of the variable in THIS line of code:
<cfset my2darrry[1][1] = "Catalog Title">

Are they the same? No.
Do you think perhaps that might be your problem?

--
Adam
Reply With Quote
  #9 (permalink)  
Old 10-09-2008, 08:40 PM
PopcornCoder
 
Posts: n/a
Diggs:
Default Re: Array issue

ok so you couldn't just point out the mispelling?

Now I am getting:

The element at position 1, of dimension 2, of an array object used as part of an expression, cannot be found.
Reply With Quote


  #10 (permalink)  
Old 10-09-2008, 08:41 PM
PopcornCoder
 
Posts: n/a
Diggs:
Default Re: Array issue

NM I got it.
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 01:08 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk