At the moment i have got all of my articles being outputted from the database but they are just organised by date with the newest first. I want to be able to have all of the articles that were posted on the same date listed together under one heading. Then do the same for all of the differnet dates/articles in my database. Any help please.
The Code the page currently looks like this, its a bit messy i know.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="
http://www.w3.org/1999/xhtml"
>
<HEAD>
<TITLE>Lock.Down.Security<
/TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<LINK href="styles-site.css" type=text/css rel=stylesheet>
</HEAD>
<BODY>
<DIV id=banner>
<H1>Lock.Down.Security</H1
>
<SPAN class=description>A website with no fixed direction of content just stuff that I
have developed or I feel is relevant</SPAN>
</DIV>
<?
include("includes/conf.php
");
include("includes/function
s.php");
$dbcnx = mysql_connect($host, $user, $pass) or die ("Unable to connect to the database");
mysql_select_db($db) or die ("unable to select the database");
$query = "SELECT id, slug, content, contact, timestamp FROM news ORDER BY timestamp DESC LIMIT 0, 2";
$result = mysql_query($query) or die ("error in query: $query. " . mysql_error());
$query2 = "SELECT timestamp FROM news ORDER BY timestamp";
$result2 = mysql_query($query2) or die ("error in query: $query2. " . mysql_error());
$row2 = mysql_fetch_object($result
2)
?>
<DIV id=content>
<DIV class=blog>
<H2 class=date><? echo formatDate($row2->timestam
p); ?></H2>
<?
if (mysql_num_rows($result) > 0)
{
while($row = mysql_fetch_object($result
))
{
?>
<DIV class=blogbody>
<H3 class=title><? echo $row->slug; ?></H3>
<br>
<P><? echo $row->content; ?></P>
</DIV>
<?
}
}
else
{
?>
<h3>No News Releases Found
<?
}
mysql_close($dbcnx);
?>
</DIV>
</DIV>
<DIV id=links>
<DIV class=sidetitle>navigation
</DIV>
<DIV class=side><A
href="index.php">Home</A><
BR><A
href="network.php">Network
</A><BR><A
href="projects.php">Projec
ts</A><BR>
<A
href="articles.php">Articl
es</A><BR>
<A
href="gallery.php">Gallery
</A><BR><A
href="links.php">Links</A>
<BR><A
href="contact.php">Contact
</A><BR>
</DIV>
<DIV class=sidetitle>Search </DIV>
<DIV class=side>
<FORM action=
http:// method=get><INPUT
type=hidden value=1 name=search> <LABEL accessKey=4 for=search>Search this
site:</LABEL><BR><INPUT id=search name=search size="34"><BR>
<INPUT type=submit value=Search style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"> </FORM>
</DIV>
</div>
</BODY>
</HTML>
Any help much appreciated
Start Free Trial