I have this four-table query:
PHP Code:
$query = "select v.category_id, c.category_name, sum(v.vote_rank), t.user_submitted, t.toolbox_id, u.name from pten_votes v
inner join pten_toolboxes t on v.toolbox_id = t.toolbox_id
inner join pten_categories c on v.category_id = c.category_id
inner join pten_users u on t.user_submitted = u.user_id
where v.category_id = {$category}
group by v.toolbox_id
order by sum(v.vote_rank) desc
LIMIT 6";
$result = mysql_query($query,$link);
while ($votes = mysql_fetch_assoc($result)) {
echo "<tr><td>{$votes['sum(v.vote_rank)']}</td><td>{$votes['name']}</td></tr>\r\n";
}
does the LIMIT 6 only look at the first six rows in the table (of 36 rows)? or only display the first six rows of the compiled dataset based on 'where category_id = X' (of approx 10 rows)?
Bookmarks