For example if submissions is 2 and comments is 1 then submissions should show 2 and comments 1. Now both of them are showing 3.
What am I doing wrong?
$query = "SELECT u.user_prestige, u.user_name, COUNT(c.comment_id) AS NumberOfComments, COUNT(c.image_id) AS NumberOfsubmissions FROM users u LEFT JOIN images i ON i.user_id = u.user_id LEFT JOIN comments c on c.user_id = u.user_id WHERE u.user_id = '$user_id'"; $result = mysql_query($query); $user = mysql_fetch_array($result); $submissions = $user['NumberOfsubmissions']; $comments = $user['NumberOfComments'];


Sign In
Create Account


Back to top









