View Single Post
  #16  
Old 29th November 2018, 16:29
darkalchemy darkalchemy is offline
Administrator
 
Join Date: Dec 2017
United States
Posts: 101
Default
Quote:
Originally Posted by Napon View Post
Code:
"IF(torrents.numratings < $minvotes, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, categories.name AS cat_name, categories.image AS cat_pic, users.username FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where$orderby$limit$class"; 
    "categories.name AS cat_name, categories.image AS cat_pic, users.username, users.class FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where$orderby$limit$class"; 
    $res = sql_query($query) or die(mysql_error());  
This appears to be correct.

@DND you do not need to do a separate query just to get owner, that's the purpose of joins. Using format_username is possible but then you need more than just class and username.
Reply With Quote