Comments
Join Hawkee
|
Login
Search
in
Code Snippets
Images
Products
Reviews
Forum
Home
Platforms
.NET
C++
Cold Fusion
CSS
Hi5
Java
Javascript
mIRC
MySpace
mySQL
OpenSocial
Perl
PHP
Python
Ruby / Rails
TCL
Images
Recently Liked
Most Liked
Most Comments
Snippets
.NET (6)
C++ (5)
Cold Fusion (1)
CSS (2)
Hi5 (1)
Java (1)
Javascript (15)
mIRC (4,216)
MySpace (2)
mySQL (1)
OpenSocial (2)
Perl (7)
PHP (140)
Python (3)
Ruby / Rails (6)
TCL (20)
Products
Computers (15,087)
Electronics (9,841)
Software (1,334)
Video Games (4,619)
Reviews
Computers (9,793)
Electronics (23,363)
Software (3,015)
Video Games (8,516)
Posts
Latest Likes
Latest Comments
All Activities
Comments
Images
Scripts
Code Snippets
Products
Reviews
Profiles
Forum
username
password
auto login
Home
>
Code Snippets
>
LordHawk's Snippets
>
PHP
News
PHP Code
+ 0
likes
Like it
Please
Register
to submit score.
Average Score
0.0
Scores Submitted
0
Date Added
Feb 22, 2008
Last Updated
Feb 22, 2008
Tags
news
Introduction
Very basic News
Grab the Code
<?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
(2)
RSS
Go to Bottom
jonesy44
Comments:
1,068
PHP Snippet:
News
Posted on
Feb 24, 2008 4:57 pm
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
LordHawk
Comments:
18
PHP Snippet:
News
Posted on
Feb 24, 2008 6:43 pm
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.
Enter comment here..
Please
Register
or
Login
to start posting comments.
LordHawk
Last seen:
Sep 20, 2008
Profile
Likes
(2)
Snippets
(4)
Comments Received
(8)
Comments Submitted
(18)
Forum Posts
(46)
My Snippet Tags
anti
cards
news
robinbot
style
swissround
Contact
Add to Friends
Send Private Message
Sponsors