First of all that's not a 3d array. Secondly from your data I'd say embedded
structs would suit you better (you might also hear the concept reffered to
as hashes or associative arrays).

// init struct
notebook = structNew();

// example using variables
structInsert(notebook, Notebook_Number, structNew());
structInsert(notebook[Notebook_Number], "title", Notebook_title);
structInsert(notebook[Notebook_Number], "owner", Notebook_Owner);

// example using hard coded data
structInsert(notebook, 34, structNew());
structInsert(notebook[45], 'title', 'Jim notebook');
structInsert(notebook[45], 'owner', 'Jim');

<!--- example of accessing the info in a <cfoutput> --->
Get the title of notebook 45: #notebook[45].title#


If instead you wanted to use an array:

// init array
notebook = arrayNew(1);

// example using variables
arrayAppend(notebook, listToArray(data));

// example using hard coded data
arrayAppend(notebook, listToArray("45,Jim notebook,Jim"));

<!--- example of accessing the info in a <cfoutput> --->
Get the title of notebook 45: #notebook[2][2]#


The array will be much faster (among other advantages) but you loose the
ability to call data by nomen. Try reading some introduction to programming
texts for the various data structures.

-----Original Message-----
From: Ray Bujarski [mailto:[EMAIL PROTECTED]]
Sent: May 18, 2001 17:43
To: CF-Talk
Subject: Array problems


I am new to arrays, I have been using lists as a crutch for some time
now.  I need to insert values into this 3d array as so
Notebook_Number, Notebook_title, Notebook_Owner

I am looping through a query but do not understand how to set the values in
this array

Example needed array:

notebooks
34,  Rays notebook,   Ray
45,  Jim notebook,  Jim

How would I do this?

Thank you!!!
Ray
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to