News

By LordHawk on Feb 22, 2008

Very basic News

<?php
// NEWS-----------------------------------------------------NEWS
  $nn = 0;
  $query="select * from `News` order by id desc;";
  $qu = mysql_query($query);
  while (($n_obj = mysql_fetch_object($qu)) && ($nn<10)) {
    printf("<table class =\"news\">\n<tr><th>%s : <span class=\"news_tp\">%s</span></th></tr>\n", $n_obj->date, $n_obj->title);
    printf("<tr><td>%s -<span class=\"auth_nm\">%s</span></td></tr>\n</table><br>",$n_obj->body, $n_obj->author);
    $nn = $nn + 1;
  }
  mysql_free_result($qu);

?>

Comments

Sign in to comment.
LordHawk   -  Feb 24, 2008

Im rather new to php, ive only been writing php for alittle over 4 months now. I am still learning the easier ways of writing php.

 Respond  
Jonesy44   -  Feb 24, 2008

i dont believe you need $nn, php 4.0 + auto inc\'s a result from an sql table, correct me if im wrong, but that\'s how i\'ve been doing it for a year or so

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.