sebbu

some sql queries from forumperso

Sep 27th, 2026
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.83 KB | Source Code | 0 0
  1. -- viewforums
  2.  
  3. SELECT p2.`fid`, p2.`titre`, p2.`description`, p1.`uid`, p4.`username`,
  4.  p1.`tid`, p1.`time` AS `timestamp`, p3.`sujet`, p2.`nb_topics`, p2.`nb_posts`, p2.`p_fid`
  5. FROM `forums_title` AS p2'.
  6. LEFT JOIN `forums` AS p1 ON p1.`pid`=p2.`last_pid`'.
  7.  LEFT JOIN `forums_topics` AS p3 ON p1.`tid`=p3.`tid`'.
  8. LEFT JOIN `users` AS p4 ON p1.`uid`=p4.`uid`'.
  9. ORDER BY p2.`fid` ASC;
  10.  
  11. -- viewsubforums
  12.  
  13. SELECT p2.`titre`, p2.`description`, p2.`moderator`, p2.`nb_topics`, p2.`nb_posts`,
  14.  p2.`p_fid`,'.// p7.`titre` AS `titre2`, p7.`p_fid` AS `p_fid2`, p8.`titre` AS `titre3`, p8.`p_fid` AS `p_fid3`,
  15. p3.`sujet`, p1.`tid`, p4.`uid`, p4.`username` , p3.`status`, p1.`time` AS `timestamp`, p3.`posts`, p6.`uid` AS `luid`, p6.`username` AS `lusername`,
  16. p5.`time` AS `ltimestamp`
  17. FROM `forums_title` AS p2
  18. LEFT JOIN `forums_topics` AS p3 ON p2.`fid`=p3.`fid`'.//' LEFT JOIN `forums_topics` AS p3 ON ( p1.`tid`=p3.`tid` AND p1.`fid`=p3.`fid` )
  19. LEFT JOIN `forums` AS p1 ON ( p1.`status` <> "R%" AND p1.`status` <> "R" AND p1.`tid`=p3.`tid` )
  20. LEFT JOIN `users` AS p4 ON p1.`uid`=p4.`uid`
  21. LEFT JOIN `forums` AS p5 ON p3.`last_pid`=p5.`pid`
  22. LEFT JOIN `users` AS p6 ON p5.`uid`=p6.`uid`
  23. --  LEFT JOIN `forums_title` AS p7 ON p2.`p_fid`=p7.`fid`
  24. --  LEFT JOIN `forums_title` AS p8 ON p7.`p_fid`=p8.`fid`
  25. WHERE p2.`fid`= "$id"
  26. ORDER BY p3.`last_pid` DESC;
  27.  
  28. -- viewtopics
  29.  
  30. SELECT p2.`titre`, p2.`description`, p2.`moderator`, p3.`sujet`,
  31. p2.`fid`, p1.`pid`, p4.`uid`, p4.`username`, p4.`avatar` , p4.`grade` , p1.`message`, p4.`signature`,
  32. p1.`status`, p3.`status` AS `t_status`, p1.`time` AS `timestamp`
  33. FROM `forums_title` AS p2
  34. LEFT JOIN `forums_topics` AS p3 ON p2.`fid`=p3.`fid`
  35. LEFT JOIN `forums` AS p1 ON p1.`tid`=p3.`tid`
  36. LEFT JOIN `users` AS p4 ON p1.`uid`=p4.`uid`
  37. WHERE p1.`tid`= "$id"
  38. ORDER BY p1.`pid` ASC;
  39.  
  40. --
  41.  
Advertisement
Add Comment
Please, Sign In to add comment