On the news script that I wrote, stories are currently shown like this:
http://www.spursweb.com/latestnews/last25.phtml
However, I would like it to be like this:
http://www.spurs-update.com/news/archive.asp?action=last20 , with the
stories split into days. How would I go about this using PHP?
This is my current code:
<?
mysql_connect("localhost", "xxx", "xxx")
or die ("Could not connect :-(");
mysql_select_db("spursdb");
if (! isset($news_index) ) {
$news_index = 0;
}
$sql = "SELECT * FROM newsdata ORDER BY id DESC LIMIT 25";
$result = mysql_query($sql);
$row = mysql_num_rows($result);
$i = 0;
while ($i < $row) {
$i = $i + 1;
$temp = mysql_data_seek($result, ($i - 1));
$myrow = mysql_fetch_array($result);
$summary = stripslashes($myrow["summary"]);
$id = $myrow["id"];
$headline = stripslashes($myrow["headline"]);
$time = stripslashes($myrow["time"]);
# Here is where you add the HTML for each news entry.
print "
<A HREF=\"http://www.spursweb.com/latestnews/shownews.phtml?id=$id\">
<b>$headline</b></A> - $time<br>
$summary<br>
<br>
"; } ?>
Also, the dates in the database are in the format of simply numbers. Would
it be possible to turn 02/05 into Tuesday 2nd May? Didn't think so...
Thanks in advance.
Cheers,
Richard
Richard Garman <richard@intanet.com>
SpursWeb <http://spursweb.com> - <webmaster@spursweb.com>