如何计算表php中的非null值

How do I count non-null variables in php database?(SQL)

This is my existing code and database in the picture:

 $jack5 = mysql_fetch_array(mysql_query("SELECT * FROM z3 WHERE ID='$users_Names' AND Score IS NOT NULL "));
 echo $jack5;

when I echo the result, I get:

Notice: Array to string conversion etc... error

I'm new to this so any help is appreciated! z3 is my table name Score is my column name

Try this:

$result = mysql_query("SELECT * FROM z3 WHERE ID='$users_Names' AND Score IS NOT NULL "));
$rowCount = mysql_num_rows($result);  // It will return the number of rows in result set

Try this,

$jack5 = mysql_query("SELECT * FROM z3 
          WHERE ID='$users_Names' AND Score IS NOT NULL");
while ($row = mysql_fetch_array($jack5))   
{ 
    print_r($row);
}

Count the number of rows by using COUNT() function.

SELECT COUNT(*) FROM z3 
WHERE  
ID='$users_Names' 
AND Score IS NOT NULL

This will return you the count of rows having the given criteria in WHERE clause.

Try this: $jack5 = mysql_fetch_array(mysql_query("SELECT count(*) FROM z3 WHERE ID='$users_Names' AND Score IS NOT NULL ")); echo $jack5;