PHP / MySQL连续获取非空列数[关闭]

I get ONE row using my sql query.

I want to count how many column of this row are not "NULL" or "", Is there any way to do this using MySQL?

try this

$row = array(0=>"abc", 1=>NULL, 2=>"NULL"); // assuming that $row is the row fetch from database

$null_count = 0;
$not_null_count = 0;
foreach($row as $val)
{
  if($val=='NULL' || $val==NULL)
  {
     $null_count+=1;
  } 
  else 
  {
    $not_null_count+=1;
  }  
}

echo "Null Count :".$null_count;
echo " Not Null Count :".$not_null_count;

See Demo