I am trying to create a small messaging system in php and mysql.
When a message is deleted I want to mark this record by replacing 0 with 1 in the record.
In the users control panel it shows you how many messages they have. But what I wanted to do was count the amount of messages when b.deleted =0
At the moment it is counting all messages regardless of whether b.deleted=0 and b.deleted=1
I saw the following code example online, and decided to use COUNT IF however I don't understand what the ,1,0 means.
Could someone please explain.
COUNT(IF(b.deleted='0',1,0))