Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I've got a news script which po

Status
Not open for further replies.

Raven333

Programmer
Oct 25, 2000
1
BE
Hi, I've got a news script which posts al the news, starting with the newest one. My question is how to post only the 10 most recent newsitems on the main page, and all the others on the archives page ? The problem is that i can only work with the posting date to do this, cause there's no ID# in the database. So i need to know how i can manipulate the lines to look at the date before posting and act accordingly to date:

<?
$result=mysql($database,&quot;select * from news order by datum desc&quot;);

while ($row = mysql_fetch_array($result)) {

$datum = date(&quot;d-m-Y&quot;, $row[datum]);

print '<table width=&quot;550&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;><tr>';
print '<td width=&quot;37&quot;><img src=&quot;images/title_links.jpg&quot; width=&quot;37&quot; height=&quot;50&quot;></td>';
print '<td width=&quot;390&quot; background=&quot;images/title_midden.jpg&quot;>';
printf (&quot;<font size=-1><a name=\&quot;%s\&quot;> %s</a></font>&quot;,$row[title],$row[title]);
print '<td width=&quot;86&quot; background=&quot;images/title_midden.jpg&quot;>';
printf (&quot;<font size=-2> $datum</font></td>&quot;,$row[title]);
print '<td width=&quot;37&quot;><img src=&quot;images/title_rechts.jpg&quot;></td><tr><br>';
print '<table width=&quot;450&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;><tr>';
printf (&quot;<br><font size=-1> %s </a></font><br><br>&quot;,$row[itemtext]);
printf (&quot;<font size=-2><p>By %s <p></a></font><br><br>&quot;,$row[postername]);

}
?>

Can you pls help me ?

thx in advance.
Raven
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top