Consider the following code
if ( isset( $_SESSION['FBID'] ) ) {
$uid = $_SESSION['FBID'];
$sql = "SELECT *, count(member_nr) AS notifyMe
FROM poolWinners
WHERE member_nr = '$uid' AND notification ='1'";
$result = mysql_query($sql);
while($row=mysql_fetch_array($result)){
$notification = $row['notifyMe'];
}//while
if ( $notification > 0 ) {
echo '<span class="badge">' . $notification . '</span>';
} //if
var_dump($notification);
} //isset( $_SESSION['FBID'] )
The above script returns how many notifications a member has as you can see in image below

My Problem
The script is returning the wrong result (wrong number of notifications). Have a look at the table below, the member number appears 3 times in the table so:
$notification = $row['notifyMe'] Should = 3 AND NOT 1
What am I missing or doing wrong here? Thanks for reading
select sumNot from poolWinners where member_nr = '$uid' AND notification = 1;no need to loop over the results, get the sum straightselect count(member_nr) from poolWinners where member_nr= '$uid' and notification = 1;and use the count instead of the sum, to avoidnotificationvalues bigger than 1. again take the full value straight, no need to loop over the result set