Reply to Re: Multi-Dimensional Arrays

Your name:

Reply:


Posted by Shelly on 07/19/05 20:15

"chadlupkes" <chadlupkes@gmail.com> wrote in message
news:1121780533.445057.291240@g43g2000cwa.googlegroups.com...
> Hi Geoff,
>
> Ok, what I'm trying to make happen is that when people type in or click
> on a link that takes them to precinctmap.php?id=2324, it will pull the
> data necessary to draw a map of that precinct. In the other arrays
> that I have built similar to this, I have used numerical values
> starting with 1. For example, in Washington State we have 9
> Congressional Districts, 49 Legislative Districts and 39 Counties.
> Each of the scripts that pull from these arrays work fine, because I'm
> able to use array values of 0-8, 0-48 and 0-38 with the 'filename-1'
> reference.
>
> For the application I am trying to create now, the precinct numbers
> start at 1281, and skip/jump up to 3423. It's not a sequential set of
> numbers. There are 224 of them, so I could create the array and
> display script to use key values of 0-223 if I have to, but I'd rather
> be able to call the specific data I need based on the precinct number
> instead of an arbritary number that only works when I know the key
> value. That's why I'm trying to use strings.
>
> I know a database might be a better way of doing this, but I have yet
> to get a good understanding of how to use databases, so I'm trying to
> work with what I know.
>
> Does that description help? I've been trying to find a tutorial page
> that explains how to call string values from arrays, but I can't find
> one that I really understand.
>
> Chad
>

How about rather than the_array[$i], using the_array["$i"]? The index is
then a string rather than a number. You will only have the 224 elements,
but their names can be "1281" or "3423". This seem like the simplest
solution to you problem.

Shelly

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация