Guest User

Untitled

a guest
Jul 23rd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. public function showArticle($nr, $start)
  2. {
  3. $catid = $_GET['catid'];
  4.  
  5. $query = "
  6. Select
  7. articles.*,
  8. user.*,
  9. article_status.*,
  10. user.id As userid,
  11. articles.id As artid,
  12. article_status.id As asid,
  13. category_articles.*
  14. From
  15. articles Inner Join
  16. article_status On articles.fk_status = article_status.id Inner Join
  17. user On articles.fk_user = user.id Inner Join
  18. category_articles On category_articles.fk_article = articles.id WHERE fk_category =$catid ORDER BY postdate DESC LIMIT $start,$nr";
  19. $result = mysql_query($query);
  20.  
  21. $queryhits = "
  22. Select
  23. articles.*,
  24. user.*,
  25. article_status.*,
  26. user.id As userid,
  27. articles.id As artid,
  28. article_status.id As asid,
  29. category_articles.*
  30. From
  31. articles Inner Join
  32. article_status On articles.fk_status = article_status.id Inner Join
  33. user On articles.fk_user = user.id Inner Join
  34. category_articles On category_articles.fk_article = articles.id WHERE fk_category =$catid ORDER BY postdate DESC";
  35. $resulthits = mysql_query($queryhits);
  36. $hits = mysql_num_rows($resulthits);
  37.  
  38.  
  39. while($row=mysql_fetch_array($result))
  40. {
  41. echo '<fieldset><legend><a href="articles.php?article='.$row['artid'].'&catid='.$row['fk_category'].'">'.$row['article_title'].'</a> posted by '.$row['user_name'].'</legend>';
  42. echo $row['article_teaser'].'...<br/>';
  43. echo $row['postdate'].'</fieldset><br/>';
  44.  
  45.  
  46.  
  47. }
  48.  
  49.  
  50. if ($hits>$nr)
  51. {
  52.  
  53. for ($i=0, $j=1;$i<$hits;$i=$i+$nr, $j++)
  54. {
  55. if ($i== $start)
  56. {
  57. echo "<b>".$j."</b>&nbsp;&nbsp;&nbsp;&nbsp;";
  58. }
  59. else
  60. {
  61. echo "<a href='articles.php?catid=".$_GET['catid']."&start=".$i."'>".$j."</a>&nbsp;&nbsp;&nbsp;&nbsp; ";
  62. }
  63. }
  64. }
  65.  
  66.  
  67.  
  68. }
Add Comment
Please, Sign In to add comment