Advertisement
sebbu

sql viewforum

Nov 14th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. $sql1='SELECT p2.`fid`, p2.`titre`, p2.`description`, p1.`uid`, p4.`username`,'.
  2. ' p1.`tid`, p1.`time` AS `timestamp`, p3.`sujet`, p2.`nb_topics`, p2.`nb_posts`, p2.`p_fid`'.
  3. ' FROM `forums_title` AS p2'.
  4. ' LEFT JOIN `forums` AS p1 ON p1.`pid`=p2.`last_pid`'.
  5. ' LEFT JOIN `forums_topics` AS p3 ON p1.`tid`=p3.`tid`'.
  6. ' LEFT JOIN `users` AS p4 ON p1.`uid`=p4.`uid`'.
  7. ' ORDER BY p2.`fid` ASC;';
  8.  
  9.  
  10. sql='SELECT p2.`titre`, p2.`description`, p2.`moderator`, p2.`nb_topics`, p2.`nb_posts`,'.
  11. ' p2.`p_fid`,'.// p7.`titre` AS `titre2`, p7.`p_fid` AS `p_fid2`, p8.`titre` AS `titre3`, p8.`p_fid` AS `p_fid3`,'.
  12. ' p3.`sujet`, p1.`tid`, p4.`uid`, p4.`username` , p3.`status`, p1.`time` AS `timestamp`, p3.`posts`, p6.`uid` AS `luid`, p6.`username` AS `lusername`,'.
  13. ' p5.`time` AS `ltimestamp`'.
  14. ' FROM `forums_title` AS p2'.
  15. ' 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` )'.
  16. ' LEFT JOIN `forums` AS p1 ON ( p1.`status` <> "R%" AND p1.`status` <> "R" AND p1.`tid`=p3.`tid` )'.
  17. ' LEFT JOIN `users` AS p4 ON p1.`uid`=p4.`uid`'.
  18. ' LEFT JOIN `forums` AS p5 ON p3.`last_pid`=p5.`pid`'.
  19. ' LEFT JOIN `users` AS p6 ON p5.`uid`=p6.`uid`'.
  20. //' LEFT JOIN `forums_title` AS p7 ON p2.`p_fid`=p7.`fid`'.
  21. //' LEFT JOIN `forums_title` AS p8 ON p7.`p_fid`=p8.`fid`'.
  22. ' WHERE p2.`fid`="'.$id.'"'.
  23. ' ORDER BY p3.`last_pid` DESC;';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement