- Fix the per category query. It was showing too many votes in some cases.
- Use query_appdb
This commit is contained in:
@@ -135,21 +135,33 @@ echo '<br />';
|
|||||||
if(strcasecmp($categoryId, "any") == 0)
|
if(strcasecmp($categoryId, "any") == 0)
|
||||||
{
|
{
|
||||||
/* leave out the appFamily.catId = '$categoryId' */
|
/* leave out the appFamily.catId = '$categoryId' */
|
||||||
$voteQuery = "SELECT appVotes.appId, appName, count(userId) as count ".
|
$sVoteQuery = "SELECT appVotes.appId, appName, count(userId) as count ".
|
||||||
"FROM appVotes, appFamily ".
|
"FROM appVotes, appFamily ".
|
||||||
"WHERE appVotes.appId = appFamily.appId ".
|
"WHERE appVotes.appId = appFamily.appId ".
|
||||||
"GROUP BY appId ORDER BY count DESC LIMIT $topNumber";
|
"GROUP BY appId ORDER BY count DESC LIMIT $topNumber";
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$voteQuery = "SELECT appVotes.appId, appName, count(userId) as count ".
|
/* Display all application for a given category (including sub categories)
|
||||||
"FROM appVotes, appFamily, appCategory ".
|
SELECT f.appId, f.appName
|
||||||
"WHERE appVotes.appId = appFamily.appId AND ".
|
FROM appFamily AS f, appCategory AS c
|
||||||
"(appFamily.catId = '$categoryId' OR ".
|
WHERE f.catId = c.catId
|
||||||
"(appFamily.catId = appCategory.catId AND appCategory.catParent = '$categoryId')) ".
|
AND (
|
||||||
"GROUP BY appId ORDER BY count DESC LIMIT $topNumber";
|
c.catId =29
|
||||||
|
OR c.catParent =29)*/
|
||||||
|
|
||||||
|
$sVoteQuery = "SELECT v.appId, f.appName, count( v.userid ) AS count
|
||||||
|
FROM appFamily AS f, appCategory AS c, appVotes AS v
|
||||||
|
WHERE v.appId = f.appId
|
||||||
|
AND f.catId = c.catId
|
||||||
|
AND (
|
||||||
|
c.catId = '$categoryId'
|
||||||
|
OR c.catParent = '$categoryId'
|
||||||
|
)
|
||||||
|
GROUP BY v.userId
|
||||||
|
ORDER BY count DESC LIMIT $topNumber";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = mysql_query($voteQuery);
|
$result = query_appdb($sVoteQuery);
|
||||||
|
|
||||||
if($result)
|
if($result)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user