Jump to content

[SOLVED] adding 2 counts to an existing query


scarhand

Recommended Posts

i need to add the following 2 queries:

 

$query = mysql_query("SELECT COUNT(*) FROM `peers` WHERE `hash` = RTRIM('$hash) AND `left` = 0 AND `expire_time` > NOW()");
$query = mysql_query("SELECT COUNT(*) FROM `peers` WHERE `hash` = RTRIM('$hash) AND `left` > 0 AND `expire_time` > NOW()");

 

to this query:

 

$sql = mysql_query("select t.id, t.uploader_id, s.memberName, t.category_id, c.name, t.hash, t.title, t.file_name, t.file_size, t.rating, t.date_uploaded
                   from thefiles as t, smf_members as s, categories as c
                   where t.uploader_id = s.ID_MEMBER and t.category_id = c.id
                   order by t.id desc
                   limit 50") or die(mysql_error());

 

i created that query myself, but i have no idea how to add the counts to it so its all in 1 nice query. can a guru help?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.