MySQL (table):
+----+------+
| id | text |
+----+------+
| 1 | |
+----+------+
| 2 | blah |
+----+------+
| 3 | |
+----+------+
| 4 | blah |
+----+------+
| 5 | blah |
+----+------+
PHP:
$a = mysql_query("SELECT COUNT(*) AS count1 FROM `table`");
$b = mysql_fetch_assoc($a);
echo $b['count1'];
Conclusion:
5
However, I also want to consider the text fields filled - in the same query, if possible.
Result:
5 in total
3 with filled text fields
user317005
source
share