Answer the question
In order to leave comments, you need to log in
Output from php database?
Good day, there is a problem, there is a mysql database in it 24 fields, 21 of them are of type int and contain either 0 or 1, how to check when outputting, if the value is 0 then the field in the html table is empty, if 1 .. There is an option to check each column, maybe someone will suggest a more adequate solution? I am attaching the code.
<?
$sql = mysql_query("SELECT * FROM structure");
while ( $show = mysql_fetch_array($sql)) {
echo '<tr>';
echo '<td> <a href="http://'.$show['Link'].'">'.$show['Name'].'</a></td>';
echo '<td> <p>'.$show['cover_rf'].''.$show['cover_rf'].''.$show['cover_regions'].''.$show['cover_ino'].''.$show['cover_msk'].'</p></td>';
echo '<td> <p>'.$show['aud_kids'].''.$show['aud_young'].''.$show['aud_buis'].''.$show['aud_par'].''.$show['aud_teach'].'</p></td>';
echo '<td> <p>'.$show['direct_educ'].''.$show['direct_prof'].''.$show['direct_carer'].''.$show['direct_psy'].''.$show['direct_buis'].''.$show['direct_soc'].'</p></td>';
echo '<td> <p>'.$show['prof_info'].''.$show['prof_art'].''.$show['prof_games'].''.$show['prof_diagnostics'].''.$show['prof_teaching'].'</p></td>';
echo '</tr>';
}
?>
Answer the question
In order to leave comments, you need to log in
$show = array_map(function($v){
if ($v == 0) return "";
return "lala";
}, $show);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question