how to count null field from database in index page in yii php tag

I want to count readdate which must be null in table. I want to fire code in html, there is one table which contains fields like id, storeid, message, readdate, entrydate. If readdate is null then I want to count it and display those counts.

   <div class="orange-count">
         echo $unread_recommendation = Storenotification::model()->count("id='" . Yii::app()->session['id'] . "' AND readdate='null' ");


Sql command for NULL count

select count(*) from table where column IS NULL;

Change it according to your framework.

Leave a Reply

Your email address will not be published. Required fields are marked *