PHP Array Turns me banging my head -
have variables retrieve withem data database so:
foreach ($row $result) { if ($row[28] == '') { $string28 = ''; }else if( $row[28] == 0){ $string28 = ''; } else{ $string28 = '<div class="add_img"><h1>connexion</h1><img src="images/'.$row[28].'.jpeg"></div>'; } } foreach ($row $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].'.jpeg"></div>'; } } foreach ($row $result) { if ($row[31] == '') { $string31 = ''; }else if($row[31] == 0){ $string31 = ''; } else{ $string31 = '<div class="add_img"><h1>schéma</h1><img src="images/'.$row[31].'.jpeg"></div>'; } }
and here's show results code:
<h1>application</h1> <div class="clear"></div> <div class="add_div"> <?php echo $string28; echo $string29; echo $string30; echo $string31; echo $string34; ?>
but can't code expression php
first want store variables in array if array empty here talking if te variables empty echo espression there's nothing
hope can me guys.
, of in advance.
your question bit confusing, tell if variable empty, use empty()
if(empty($string28)) { // since it's empty }
it work on arrays ...
$array = array(); if(empty($array)) { echo "yep, it's empty!"; }
Comments
Post a Comment