View Single Post
  #1  
Old 18th June 2023, 13:39
Extremlym's Avatar
Extremlym Extremlym is offline
Senior Member
 
Join Date: Oct 2012
P2P
Posts: 102
Default Replace query JOIN (help)
hello i wont to replace this LEFT JOIN , i think is loading my database sql , i tryed something but is not working . pls some help



PHP Code:
//Get Total For Pager$res = mysql_query("SELECT COUNT(*) FROM torrents LEFT JOIN categories ON category = categories.id $where") or die(mysql_error());$row = mysql_fetch_array($res);$count = $row[0];//get sql infoif ($count) {    list($pagertop, $pagerbottom, $limit) = pager(35, $count, "torrents.php?" . $addparam);$query = "SELECT torrents.id, torrents.category, ...., torrents.name, torrents.size, torrents.added, torrents.torrentlang, torrents.owner, categories.name AS cat_name, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat AS cat_parent, categories.image AS cat_pic, users.username, users.privacy,  IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id $where $orderby $limit" ;        $res = mysql_query($query) or die(mysql_error());}else{    unset($res);} 
Reply With Quote