If it is to check only one column, make one SELECT
counting the results, using as attribute, if the column is not empty (IS NOT NULL
), in the clause WHERE
. Then you’ll know if there are any results. In the following example how to validate if there are records for the column, to make your select you must put all items that are necessary for the query you were doing, to get the correct result.
SELECT count(COLUNA) as TOTAL FROM TABLEA WHERE COLUNA IS NOT NULL;
In this case you will get the result of select with the alias "TOTAL
" and if it is different from 0
, then display the results from another SELECT
preeminently.
Making the way this above will reduce consumption of MYSQL
, since otherwise will return a row from the entire table, for at the end of the empty column ignore it. Although using the IS NOT NULL
and put the column even in mysql also will not give error, but in this case it will be necessary to use the mysql_num_rows
and that would consume more resources than making a count
in a field.
<?php if (!empty($exibe_painel_usuarios_um [ "twitter" ]))
just deny– rray
Solved, echo "<div class="equipe_redes_twitter">". $exibe_painel_usuarios_um [ "twitter" ]."</div>";
– Josimara
Thanks for the help.
– Josimara
De boa veiow. o
– rray