FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Is my array understanding correct?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Is my array understanding correct? [message #178780] Thu, 02 August 2012 15:28 Go to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
<?php


$artistsA = array(
"A.B. Skhy" => array("chart"=>"Camel Back","Flip"=>"Just What I
Need","Label"=>"MGM K14086","Date"=>"12/8/69"),
"Aaron Neville" => array("chart"=>"She Took You For A Ride","Flip"=>"Space
Man","Label"=>"Parlo 103","Date"="3/25/67",
"chart"=>"Tell It Like It Is","Flip"=>"Why
Worry","Label"=>"Parlo 101","Date"=>"12/3/66")
);
?>

Eventually, the output will look just like this page does now.
http://mroldies.net/Artists-A1.html

Each time a new "artist" table is created, the code will produce the
required rows and columns.
Question is, is it proper to have the key names as I show?
Or do I need to uniquely identify each key value somehow?

Then, there is the problem of linking that I do not yet understand.
My thinking is instead of linking each title, just use a button in another
column.Then that would make things easier for coding.
Re: Is my array understanding correct? [message #178781 is a reply to message #178780] Thu, 02 August 2012 18:01 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
richard <noreply(at)example(dot)com> wrote in news:13wa7y8varcbm$.1te7fi50zhu8l.dlg@
40tude.net:

>
> <?php
>
>
> $artistsA = array(
> "A.B. Skhy" => array("chart"=>"Camel Back","Flip"=>"Just What I
> Need","Label"=>"MGM K14086","Date"=>"12/8/69"),
> "Aaron Neville" => array("chart"=>"She Took You For A Ride","Flip"=>"Space
> Man","Label"=>"Parlo 103","Date"="3/25/67",
> "chart"=>"Tell It Like It Is","Flip"=>"Why
> Worry","Label"=>"Parlo 101","Date"=>"12/3/66")
> );
> ?>
>
> Eventually, the output will look just like this page does now.
> http://mroldies.net/Artists-A1.html

Why do you think you need to put it in an array at all?
Re: Is my array understanding correct? [message #178782 is a reply to message #178780] Thu, 02 August 2012 18:28 Go to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(richard)

> <?php
>
>
> $artistsA = array(
> "A.B. Skhy" => array("chart"=>"Camel Back","Flip"=>"Just What I
> Need","Label"=>"MGM K14086","Date"=>"12/8/69"),
> "Aaron Neville" => array("chart"=>"She Took You For A Ride","Flip"=>"Space
> Man","Label"=>"Parlo 103","Date"="3/25/67",
> "chart"=>"Tell It Like It Is","Flip"=>"Why
> Worry","Label"=>"Parlo 101","Date"=>"12/3/66")
> );
> ?>
>
> Eventually, the output will look just like this page does now.
> http://mroldies.net/Artists-A1.html
>
> Each time a new "artist" table is created, the code will produce the
> required rows and columns.
> Question is, is it proper to have the key names as I show?
> Or do I need to uniquely identify each key value somehow?

Only problem will be artists of the same name, so a unique numeric key
might be better. But why don't you use a database?

If you want to stick with the arrays, you could use a single array for
all artists, sorted by name.

Micha

--
http://mfesser.de/
Fotos | Blog | Flohmarkt
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ncurses on Linux how to capture F1 key?
Next Topic: str_replace, replace array with string AND array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 09:48:04 GMT 2024

Total time taken to generate the page: 0.02134 seconds