Page 1 of 1

Array, Poster.

Posted: Thu Nov 27, 2003 7:25 pm
by William
I am trying to make a news poster for a friend and i gave up doing it with include .ect. Is there but i tryed doing it with arrays and i cant get it to show anyhting. it only shows stuff liek Array Array Array Array Array and thats it... I can post the array code but the page i cant i can show the php code that gets the array. Sorry about not being able to show the rest not my site.

db.php

Code: Select all

<?php
$posts = array ( 
array ( "
<table width=75% border=0>
<tr> 
<td><font color=00FF00>BREAKING THE HABIT....NEXT SINGLE</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<p>
<font color=000000>
Today during the LP chat Chester said himself that Breaking the habit will be the next single. This is 
a quote from the chat - 
</font>
</p>11/27/2003
<p>
CHAZrocks - What is your next single? Did you know 
Lars was going to come on stage and chase you around? Is it true you never 
sleep? And hi, LP rocks.
</p>
<p>
Chester - Yes i rarely sleep. No i didn't know 
Lars was going to do that. The next single is Breaking the habit. </font></p>
<p>
You all may not know Mike Shinodas words saying 
that BTH will never be a single, in this case Warner brothers got to choose.
</p>
<p>The video shoot will be in December!</font>
</p>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>LP Up For Song Of The Year!!</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Somewhere I Belong is nominated 
for Song Of The Year for Launch's 2003 Music Awards. 
<p>
Here are the rest of the nominees:<br>
In Da Club - 50 Cent<br>
Crazy In Love - Beyonce<br>
Bring Me To Life - Evanescence<br>
Get Busy - Sean Paul </p>
<p>
You can vote for LP here:&nbsp;&nbsp;[<a href=http://home.php>Launch.com</a>]
</p>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Joe Hahns movie idea</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
<img src=0312890729.M.jpg name=newsimage width=92 height=140 hspace=5 vspace=5 border=0 align=right id=newsimage>
Hahn got the right to a favourite book of his called "King Rat" he has 1 year to make the scripts and get organized for movie filming. On tuesday on MOJO radio am 730 Brad and Joe were being interviewed on loveline. By request i could record the tape onto the my computer and upload it for a free download.
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>WATCH FROM THE INSIDE</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
<h2>It's on the videos page!</h2>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
"),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>From The Inside Download</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
You can *legally* download LP's new video <a href=http://www.7digitalmedia.com/downloads/linkin/location.asp>HERE</a> for about $2.00 
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Live in Texas Player</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Brand new player from the one and only Linkin Park<br /><a href=http://www.bandbuilder.com/lptexas/index.php?ref_code=D30503>Click Here</a>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Videos</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Check Out the videos page. If you have a request for a video e-mail me and I will Upload it.
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Back And Better Than Ever</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Hybrid Soldier Is Back!!! E-mail your comments 
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" )
);
?>
retrieve posts:

Code: Select all

<?php 
	include("db.php");
	foreach ( $posts as $news ) {
		print "$news<br />";
	}
	?>
?>

Posted: Thu Nov 27, 2003 8:01 pm
by Joan Garnet
Note that this is a bidimensional array and you are accessing the first dimension.
That works:

Code: Select all

foreach ( $posts as $news ) 
&#123; 
	foreach ( $news as $news2 )
	&#123;
	  print "$news2<br />"; 
	&#125;
&#125;
bye!

Thanks

Posted: Thu Nov 27, 2003 8:09 pm
by William
Ill try that thanks!