zhshero Posted November 19, 2010 Share Posted November 19, 2010 hey i'm just woundering how i would go abouts on echoing unread messages sent to a user i want to beable to see how many unread messages i have Quote Link to comment https://forums.phpfreaks.com/topic/219175-how-would-i-count/ Share on other sites More sharing options...
rwwd Posted November 19, 2010 Share Posted November 19, 2010 Some code that you have would help, show us what you have first, then we can help.. Rw Quote Link to comment https://forums.phpfreaks.com/topic/219175-how-would-i-count/#findComment-1136532 Share on other sites More sharing options...
zhshero Posted November 19, 2010 Author Share Posted November 19, 2010 i don't really have much of a code, half way of doing so i started thinking this can't be right and now i'm unsure where to even start $sql = mysql_query("SELECT count(message_id) FROM messages WHERE MATCH(to_user='$userfinal', message_read)"); $total = mysql_fetch_array($sql); $num = $total[0]; echo $num; Quote Link to comment https://forums.phpfreaks.com/topic/219175-how-would-i-count/#findComment-1136534 Share on other sites More sharing options...
litebearer Posted November 19, 2010 Share Posted November 19, 2010 Please show the structure of you database - do you have a field to indicate if a message is read or unread? Quote Link to comment https://forums.phpfreaks.com/topic/219175-how-would-i-count/#findComment-1136578 Share on other sites More sharing options...
zhshero Posted November 19, 2010 Author Share Posted November 19, 2010 message_id from_user to_user user_photo message_title message_contents message_read message_date Quote Link to comment https://forums.phpfreaks.com/topic/219175-how-would-i-count/#findComment-1136594 Share on other sites More sharing options...
trq Posted November 19, 2010 Share Posted November 19, 2010 Seriously, can you please change that avatar? Pictures of half naked kids aren't exactly what I'm expecting on a developers forum. Quote Link to comment https://forums.phpfreaks.com/topic/219175-how-would-i-count/#findComment-1136595 Share on other sites More sharing options...
zhshero Posted November 19, 2010 Author Share Posted November 19, 2010 sorry, there i changed it Quote Link to comment https://forums.phpfreaks.com/topic/219175-how-would-i-count/#findComment-1136600 Share on other sites More sharing options...
zhshero Posted November 19, 2010 Author Share Posted November 19, 2010 Nvm i got it XD $sql = mysql_query("SELECT count(message_id) FROM messages WHERE to_user='$userfinal' AND message_read='1'"); $total = mysql_fetch_array($sql); $num = $total[0]; echo $num; Quote Link to comment https://forums.phpfreaks.com/topic/219175-how-would-i-count/#findComment-1136647 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.