Tjobbe
June 12th, 2007, 13:39
I have created a simple cms in tthe past and I'm now editing it to use it for a client's site.
I hope to have an archive page, showing x amount of article snippets, which link through to the full article. There is also to be a "< next | previous >" pagination on the page, which is what I am stuck on.
It has been 6 months since I last touched php and I'm really struggling, here is what I have right now in my <body>;
<?php
include "admin/dbconnect.php";
include "includes/format_date.php";
$result = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 0,5");
//echo's the articles, and even properly indents the code
while($row = mysql_fetch_array($result))
{echo "
<p><em>".$row['shortdescr']."</em></p>
<p>".$row['title']."</p>
<p>".$row['source']."</p>
<p><strong>Posted on:</strong> ".$row['date']."</p>
<hr />
";
}
mysql_close($conn);
?>
This loops through the db and shows the latest 5 posts.
Trouble is, I haven't a clue where to go from here! Can anyone lend this poor man a hand?
I hope to have an archive page, showing x amount of article snippets, which link through to the full article. There is also to be a "< next | previous >" pagination on the page, which is what I am stuck on.
It has been 6 months since I last touched php and I'm really struggling, here is what I have right now in my <body>;
<?php
include "admin/dbconnect.php";
include "includes/format_date.php";
$result = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 0,5");
//echo's the articles, and even properly indents the code
while($row = mysql_fetch_array($result))
{echo "
<p><em>".$row['shortdescr']."</em></p>
<p>".$row['title']."</p>
<p>".$row['source']."</p>
<p><strong>Posted on:</strong> ".$row['date']."</p>
<hr />
";
}
mysql_close($conn);
?>
This loops through the db and shows the latest 5 posts.
Trouble is, I haven't a clue where to go from here! Can anyone lend this poor man a hand?