Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-21-2008, 02:29 AM   PM User | #1
aimerzz4
New Coder

 
Join Date: Jun 2007
Posts: 98
Thanks: 12
Thanked 3 Times in 3 Posts
aimerzz4 is an unknown quantity at this point
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 02:33 AM..
aimerzz4 is offline   Reply With Quote
Old 02-21-2008, 02:36 AM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 02-21-2008, 02:39 AM   PM User | #3
aimerzz4
New Coder

 
Join Date: Jun 2007
Posts: 98
Thanks: 12
Thanked 3 Times in 3 Posts
aimerzz4 is an unknown quantity at this point
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.
aimerzz4 is offline   Reply With Quote
Old 02-21-2008, 02:42 AM   PM User | #4
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 02-21-2008, 02:45 AM   PM User | #5
aimerzz4
New Coder

 
Join Date: Jun 2007
Posts: 98
Thanks: 12
Thanked 3 Times in 3 Posts
aimerzz4 is an unknown quantity at this point
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.)
aimerzz4 is offline   Reply With Quote
Old 02-21-2008, 02:53 AM   PM User | #6
Deacon Frost
Regular Coder

 
Deacon Frost's Avatar
 
Join Date: Feb 2008
Location: Between the Lines
Posts: 279
Thanks: 31
Thanked 4 Times in 4 Posts
Deacon Frost is on a distinguished road
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.
Deacon Frost is offline   Reply With Quote
Old 02-21-2008, 03:32 AM   PM User | #7
aimerzz4
New Coder

 
Join Date: Jun 2007
Posts: 98
Thanks: 12
Thanked 3 Times in 3 Posts
aimerzz4 is an unknown quantity at this point
Right. I suck at math and don't really get this at all.

Anyone available for hire?
aimerzz4 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:24 AM.


Advertisement
Log in to turn off these ads.