Guest User

Untitled

a guest
Jan 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?
  2. /*
  3. Directory: /news/home.php
  4. Scripted by: Daniel Szczech
  5. */
  6.  
  7. $news_id = $_GET['newsid'];
  8.  
  9. if(!$news_id) {
  10. $news = mysql_query("SELECT * FROM `hp_news` ORDER BY `id` DESC");
  11. if(mysql_num_rows($news) == 0) {
  12. echo "There is no any news!";
  13. } else {
  14. while($news_result = mysql_fetch_array($news)) {
  15. $comments_query = mysql_query("SELECT * FROM `hp_news_comments` WHERE `news_id`='".$news_result['id']."'");
  16. $comments = mysql_num_rows($comments_query);
  17. echo "Title: ".$news_result['title']."<br />";
  18. echo "Content: ".$news_result['content']."<br />";
  19. echo "> ><a href='?page=news/home.php?newsid=".$news_result['id']."'>More / Comments ($comments)</a>< <<br />";
  20. echo "------------------------------------------------------<br />";
  21. }
  22. }
  23. } else {
  24. echo "inside the news!";
  25. }
  26. ?>
Add Comment
Please, Sign In to add comment