Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function showArticle($nr, $start)
- {
- $catid = $_GET['catid'];
- $query = "
- Select
- articles.*,
- user.*,
- article_status.*,
- user.id As userid,
- articles.id As artid,
- article_status.id As asid,
- category_articles.*
- From
- articles Inner Join
- article_status On articles.fk_status = article_status.id Inner Join
- user On articles.fk_user = user.id Inner Join
- category_articles On category_articles.fk_article = articles.id WHERE fk_category =$catid ORDER BY postdate DESC LIMIT $start,$nr";
- $result = mysql_query($query);
- $queryhits = "
- Select
- articles.*,
- user.*,
- article_status.*,
- user.id As userid,
- articles.id As artid,
- article_status.id As asid,
- category_articles.*
- From
- articles Inner Join
- article_status On articles.fk_status = article_status.id Inner Join
- user On articles.fk_user = user.id Inner Join
- category_articles On category_articles.fk_article = articles.id WHERE fk_category =$catid ORDER BY postdate DESC";
- $resulthits = mysql_query($queryhits);
- $hits = mysql_num_rows($resulthits);
- while($row=mysql_fetch_array($result))
- {
- echo '<fieldset><legend><a href="articles.php?article='.$row['artid'].'&catid='.$row['fk_category'].'">'.$row['article_title'].'</a> posted by '.$row['user_name'].'</legend>';
- echo $row['article_teaser'].'...<br/>';
- echo $row['postdate'].'</fieldset><br/>';
- }
- if ($hits>$nr)
- {
- for ($i=0, $j=1;$i<$hits;$i=$i+$nr, $j++)
- {
- if ($i== $start)
- {
- echo "<b>".$j."</b> ";
- }
- else
- {
- echo "<a href='articles.php?catid=".$_GET['catid']."&start=".$i."'>".$j."</a> ";
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment