PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, December 30, 2021

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

 December 30, 2021     php, yii     No comments   

Issue

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.

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

Solution

Sql command for NULL count

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

Change it according to your framework.



Answered By - Vineet1982
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing