I am selecting a number of database columns from a MySQL database. I would like to count the number of returned MySQL rows from a particular set that is not NULL.
For example…
SELECT p.wavURL1, p.wavURL2, p.wavURL3, p.wavURL4, etc.
Can I count in PHP the number of these that are not NULL?
If I understand your question correctly, this should do what you want:
See the MySQL manual for more details:
COUNT– Returns a count of the number of non-NULL values of expr in the rows retrieved by a SELECT statement.COALESCE– Returns the first non-NULL value in the list, or NULL if there are no non-NULL values.