MuratOSMA adlı üyeden alıntı: mesajı görüntüle
Merhabalar,

$dizicount adında bir değişkenim var.
Bu değişkenin değeri eşitse sıfıra Listelenecek Veri Yok! yazsın, değilse aşağıdaki kodları uygulamak istiyorum ama Php'ye yeni başladığım için php html kurgusunda sorun yaşıyorum.

Bu konuda desteğinizi rica ediyorum..

Teşekkürler.

		<div align="center">
		  <table class="highlight" style="width:60%;margin-top:10px;">
			<thead>
				<tr>
				  <th>Date</th>
				  <th>Time</th>
				  <th>City</th>
				  <th>Description</th>
				</tr>
				</thead>
				<tbody>
				
				<?php	
				for ($i = 0 ; $i <= $dizicount-1;$i++){?>	
				<tr>
				  <td><?php echo $data['TrackingStatusJSON']['statusInfos'][$i]['date']; ?></td>
				  <td><?php echo $data['TrackingStatusJSON']['statusInfos'][$i]['time']; ?></td>
				  <td><?php echo $data['TrackingStatusJSON']['statusInfos'][$i]['city']; ?></td>
				  <td><?php echo $data['TrackingStatusJSON']['statusInfos'][$i]['contents'][0]['label']; ?></td>
				</tr>
			  <?php ;} ob_end_flush();?>	
				</tbody>
		  </table>
		</div>
Merhaba ,

eğer $dizicount 0'a eşitse bir if döngüsü ile kontrol edebilirsiniz. else içerisine de for döngüsünü alırsanız 0 a eşit olduğu durumlarda for döngüsüne girmeyecektir.

Kolay gelsin.

        <div align="center"> 
          <table class="highlight" style="width:60%;margin-top:10px;"> 
            <thead> 
                <tr> 
                  <th>Date</th> 
                  <th>Time</th> 
                  <th>City</th> 
                  <th>Description</th> 
                </tr> 
                </thead> 
                <tbody> 
                 
                <?php   
                if ($dizicount == 0){
echo 'Listelenecek veri yok ';
}
else {
for ($i = 0 ; $i <= $dizicount-1;$i++){?>     
                <tr> 
                  <td><?php echo $data['TrackingStatusJSON']['statusInfos'][$i]['date']; ?></td> 
                  <td><?php echo $data['TrackingStatusJSON']['statusInfos'][$i]['time']; ?></td> 
                  <td><?php echo $data['TrackingStatusJSON']['statusInfos'][$i]['city']; ?></td> 
                  <td><?php echo $data['TrackingStatusJSON']['statusInfos'][$i]['contents'][0]['label']; ?></td> 
                </tr> 
              <?php ;} ob_end_flush();?> 
}
                    
                </tbody> 
          </table> 
        </div>