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