Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jun 2007
    Posts
    98
    Thanks
    12
    Thanked 3 Times in 3 Posts

    Newbie Array Help

    I know this is a seriously dumb question, but I guess I have to ask sometime. I am trying to create arrays for a list of comic book issues I have collected.

    For Example:

    PHP Code:
    $axm '<hr><p class="center"><b><a name="axm">Astonishing X-Men</a></b></p>
         <p class="center">Astonishing X-Men #1<br><br>
          Astonishing X-Men #2<br><br>
          Astonishing X-Men #3<br><br>
          Astonishing X-Men #4<br><br>
          Astonishing X-Men #5<br><br>
          Astonishing X-Men #6<br><br>
          Astonishing X-Men #7<br><br>
          Astonishing X-Men #8<br><br>
          Astonishing X-Men #9<br><br>
          Astonishing X-Men #10<br><br>
          Astonishing X-Men #11<br><br>
          Astonishing X-Men #12<br><br>
          Astonishing X-Men #13<br><br>
          Astonishing X-Men #14<br><br>
          Astonishing X-Men #15<br><br>
          Astonishing X-Men #16<br><br>
          Astonishing X-Men #17<br><br>
          Astonishing X-Men #18<br><br>
          Astonishing X-Men #19<br><br>
          Astonishing X-Men #20<br><br>
          Astonishing X-Men #21<br><br>
          Astonishing X-Men #22<br><br>
          Astonishing X-Men #23<br><br>
          Astonishing X-Men #24<br><br>Giant Sized Astonishing X-Men #1</p><br><br>'
    ;
    $bp '<hr><p class="center"><b><a name="bp">Black Panther</a></b></p><p class="center">
    Black Panther #18<br><br>
    Black Panther #22<br><br>
    Black Panther #31</p><br><br>'
    ;
    $cd '<hr><p class="center"><b><a name="cd">Cable & Deadpool</a></b></p>
    <p class="center">Cable & Deadpool #6<br><br>
    Cable & Deadpool #7<br><br>
    Cable & Deadpool #8<br><br>
    Cable & Deadpool #9</p><br><br>'

    I would like all of those issues turned into something such as $ongoing as well. I could echo the command $ongoing which would show all Astonishing X-Men, Black Panther, and Cable & Deadpool issues, but if I just wanted to show Astonishing X-Men, then I'd use $axm

    Get what I mean?

    So far, I have been trying this by basing off of this manual http://us2.php.net/function.array (at least I'm trying) :
    PHP Code:
    <?php
    $ongoing 
    = array($axm$bp$cd =>);
    print_r($ongoing);
    ?>
    I dont' think that would work, but if anyone can get what I'm saying, thanks.
    Last edited by aimerzz4; 02-21-2008 at 03:33 AM.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Why do you have all that data inside of a variable when its just static? Why not just hard code the html into your page?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Jun 2007
    Posts
    98
    Thanks
    12
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    Why do you have all that data inside of a variable when its just static? Why not just hard code the html into your page?
    Because I have the issue lists separated in alphabetical order and do not want to edit each page any time I add a new issue to the list.

    I've been hoping to make the little PHP script a little more complex, so I can do more things to list I have, such as categorize it as ongoing title, miniseries, etc, through an echo like $ongoing or $miniseries.

    Would also like a CMS so I can add issues through a login system instead of directly editing the issues. Don't know how I'll do THAT though. Will probably have to hire someone.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You should probably look into a database then. Also you do know that you can use php includes? Create one file, upload it include it where you want it. If you need to add to it or rearrange stuff them then just again edit the one file, problem solved though if you intend on categorizing stuff I think you need a database.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Jun 2007
    Posts
    98
    Thanks
    12
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    You should probably look into a database then. Also you do know that you can use php includes? Create one file, upload it include it where you want it. If you need to add to it or rearrange stuff them then just again edit the one file, problem solved though if you intend on categorizing stuff I think you need a database.
    That sounds like a good idea - using a database. Do you have any script recommendations for something like this?

    (I have too many issues to rearrange and organize manually.)

  • #6
    Regular Coder Deacon Frost's Avatar
    Join Date
    Feb 2008
    Location
    Between the Lines
    Posts
    279
    Thanks
    31
    Thanked 4 Times in 4 Posts
    Might I recommend reading http://w3schools.com/php/php_arrays.asp . It teaches rather well about arrays and each kind to how they work. Scroll down to the bottom of the lesson where it says:

    Multidimensional Arrays

    I think that's what you're trying to achieve.

  • #7
    New Coder
    Join Date
    Jun 2007
    Posts
    98
    Thanks
    12
    Thanked 3 Times in 3 Posts
    Right. I suck at math and don't really get this at all.

    Anyone available for hire?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •