Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // check to find the post breakdown of the user
- $query = "SELECT 'total' as `k`, count(c.`id`) as v
- FROM `".DB_PREF."comments` c
- WHERE c.`author_hash`='$key'
- GROUP BY c.`author_hash`
- UNION
- SELECT 'totalvisible' as `k`, count(c.`id`) as v
- FROM `".DB_PREF."comments` c
- WHERE c.`author_hash`='$key'
- AND c.`visible`=1
- GROUP BY c.`author_hash`
- UNION
- SELECT 'totaldead' as `k`, count(c.`id`) as v
- FROM `".DB_PREF."comments` c
- WHERE c.`author_hash`='$key'
- AND c.`visible`!=1
- GROUP BY c.`author_hash`
- UNION
- SELECT 'killed' as `k`, count(c.`id`) as v
- FROM `".DB_PREF."comments` c
- WHERE c.`author_hash`='$key'
- AND c.`visible`=0
- GROUP BY c.`author_hash`
- UNION
- SELECT 'autokilled' as `k`, count(c.`id`) as v
- FROM `".DB_PREF."comments` c
- WHERE c.`author_hash`='$key'
- AND c.`visible`=-1
- GROUP BY c.`author_hash`
- UNION
- SELECT 'spam' as `k`, count(c.`id`) as v
- FROM `".DB_PREF."comments` c
- WHERE c.`author_hash`='$key'
- AND c.`visible`=-2
- GROUP BY c.`author_hash`";
- $result = run_query($query);
- $breakdown = array();
- while ($row = mysqli_fetch_assoc($result)) {
- $breakdown[$row['k']] = intval($row['v']);
- }
- mysqli_free_result($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement