I want to count(id) if an user has new chat messages.
My problem is if there is no message it doesn't give me 0 as a result. What is wrong?
$stmt = $mysqli->prepare("SELECT count(id) FROM chat WHERE `to`=? and recd='0' group by `from`");
$stmt->bind_param('s', $user);
$stmt->execute();
$stmt->bind_result($chatcont);
$stmt->fetch();
$stmt->close();
php:
echo "($chatcont)";
if no message I have:
()
I want to show 0 inside this.