如果你能帮助我,我有一个问题要问你,我有一些变量,我用它们从数据库中检索数据,但我想解决这个问题
if all the variables are empty then show something if not then show the just the variables that have data
。
该代码是:
foreach ($row as $result) {
if ($row[29] == '') {
$string29 = '';
}else if ($row[29] == 0){
$string29 = '';
} else{
$string29 = '<div class="add_img"><h1>Pression</h1><img src="images/'.$row[29].'.png"></div>';
}
}
foreach ($row as $result) {
if ($row[30] == '') {
$string30 = '';
}else if($row[30] == 0){
$string30 = '';
} else{
$string30 = '<div class="add_img"><h1>Fixation</h1><img src="images/'.$row[30].'.png"></div>';
}
}
`
然后我有
echo &string29 and so on........