homepage Welcome to WebmasterWorld Guest from 54.205.144.54
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Data in a table
Mr_Cat




msg:3852273
 12:43 pm on Feb 18, 2009 (gmt 0)

Hi folks, I'm just learning php and am having a bit of trouble reproducing some data in a table. I'm wondfering if anyone can help, I'm sure the answer must be simple.

I'm trying to get database entries to list accross the page 4 table cells at a time.

<?php
echo '<table width="90%" border="0" cellpadding="4" align="center" class="ssi_table">
<tr>';

$array = ssi_boardNews(2.0, 20, null, 250, 'array');
$count = 0;

foreach ($array as $news)

if ($count <= 4)

{
echo '
<td align="center" valign="top" bgcolor="#E4EDFC"><b>
"<a href="', $news['href'], '">', $news['subject'], '</a>"</b><br>
<span class="smallprint"> posted by </span>', $news['poster']['link'], ' - ', $news['time'], ' ', $txt[525], $count ,'</td>';

$count = ($count + 1);
}

else
{
echo '</tr><td align="center" valign="top" bgcolor="#E4EDFC"><b>
"<a href="', $news['href'], '">', $news['subject'], '</a>"</b><br>
<span class="smallprint"> posted by </span>', $news['poster']['link'], ' - ', $news['time'], ' ', $txt[525], $count ,'</td>';

$count = ($count + 1);
}

echo ' </tr>
</table>

';


?>

Here is the code I've been playing with so far which doesn't help me much past post 4 as you may see.

I've been trying some use of the ¦¦ (or) operator in the if statement but obviously not correctly as my page just turns up blank.

Can anyone see a nice clean answer for me?

Cheers

 

wheelie34




msg:3852290
 1:29 pm on Feb 18, 2009 (gmt 0)

Hi Mr_Cat

Have a look at this one by jatar_k #1300710 on this page

[webmasterworld.com ]

I use it all the time, does exactly what you want I think

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved