title: PHP Mysqli show the result of count sum
body: <p>I have the following code. It works correctly on phpmyadmin. What i have to change to show the sum of SUM_OF_NULLs?</p>
  
  <pre><code>$query = "
      SELECT (
          (CASE WHEN `name_kid`='X' THEN 1 ELSE 0 END)
          +(CASE WHEN `name_kid`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `name_kid`='A' THEN 1 ELSE 0 END)
          +(CASE WHEN `bday`='0000-00-00' THEN 1 ELSE 0 END)
          +(CASE WHEN `born_city`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `born_country`='X' THEN 1 ELSE 0 END)
          +(CASE WHEN `topos_katoikias`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `ithageneia`='0' THEN 1 ELSE 0 END)
          +(CASE WHEN `amea_text`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `date_eis`='0000-00-00' THEN 1 ELSE 0 END)
          +(CASE WHEN `date_exit`='0000-00-00' THEN 1 ELSE 0 END)
          +(CASE WHEN `sur_fysikos`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `name_fysikos`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `ithag_fysikos`='0' THEN 1 ELSE 0 END)
          +(CASE WHEN `sur_mother_fys`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `name_mother_fys`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `ithag_mother_fys`='0' THEN 1 ELSE 0 END)
          +(CASE WHEN `sur_anad`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `name_anad`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `sur_mother_anad`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `name_mother_anad`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `city_anad`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `sur_thet`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `name_thet`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `sur_thet_mother`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `name_thet_mother`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `city_thet`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `ar_apof`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `date_apof`='0000-00-00' THEN 1 ELSE 0 END)
          +(CASE WHEN `protodikio`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `case_close`='0000-00-00' THEN 1 ELSE 0 END)
          +(CASE WHEN `kid_thetos_sur`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `kid_thetos_name`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `arithmos_mitrwou`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `code_forea_filox`='00' THEN 1 ELSE 0 END)
          +(CASE WHEN `ar_forea_filox`='' THEN 1 ELSE 0 END)
          +(CASE WHEN `code_forea_fakelos`='00' THEN 1 ELSE 0 END)
          +(CASE WHEN `sxetikoi_fakeloi`='00' THEN 1 ELSE 0 END)
          +(CASE WHEN `sur_kid`='' THEN 1 ELSE 0 END)
      ) AS SUM_OF_NULLs FROM `fakelos-final`
  ";
  if ($result2 = $mysqli-&gt;query($query)) {
      printf("Total: %d \n", $result2-&gt;SUM($result2));
  
      /* free result set */
      $result2-&gt;close();
  }
  </code></pre>