2
I have a MYSQL client registration database.
I need to make a query to know the amount of blank columns each record has.
For example, in total I have 15 columns (name, email, address, etc) and "So" only registered the name, so the return of this query should be 14, because the total is 15 columns and he only filled 1.
The result can come directly from the MYSQL query or, if needed, with the help of PHP (using foreach, for, or any other type)
Thank you!
Edit* So I found the following temporary solution
SELECT * FROM clientes WHERE idcliente = 4;
and in PHP
$result = $db->query($sql);
$resultados= $result->fetchAll( PDO::FETCH_ASSOC );
$count=0;
foreach($resultados[0] as $valor){
if($valor!=''){
$cont++;
}
}
There I use $Count as the amount of fields filled.
Have you tried anything? What was the result obtained?
– Woss
I was researching and had not found anything, but I found now a solution, it is not ideal yet, but gave to solve, I will put in the question
– Leandro Marzullo