Foreach döngü benim kod belirli satır yinelenen değil

0 Cevap php

Benim web sitesinin gelen sayfadaki her döngü için var:

<table width="40%" border="0">
  <tr><p id="links">
    <a href="#" id="all" class="pseudo">all</a>,
    <a href="#" id="none" class="pseudo active">none</a>,
    <a href="#" id="read" class="pseudo">read</a>,    
    <a href="#" id="unread" class="pseudo">unread</a>,
    <a href="#" id="replied" class="pseudo">replied</a>,
    <a href="#" id="fav" class="pseudo">favourite</a>
</p>
    <td width="5%"></td>
    <td width="5%"></td>
    <td width="22%"></td>
    <td width="19%"></td>
    <td width="60%"></td>
    <td width="17%"></td>
  </tr>

 <?php foreach ($query as $row):  ?>
  <tr>
    <?php switch($row['status']){
        case 0: $status = "unread"; break;            
        case 1: $status = "read"; break;
        case 2: $status = "replied"; break;
        case 3: $status = "fav"; break;
        default: $status = '';           
    }?>

    <td width="5%"><input name="message" id="messages" type="checkbox" value="" class="<?php echo $status; ?>"/></td>
    <td width="5%"><input name="sunny" id="sunny" type="checkbox" value="" class="" checked="checked" /></td>
    <td><?php echo $status; ?></td>
    <td><?php echo $row['from_user']; ?></td>
    <td><div id="test"><a href="<?php echo site_url("messages/read_message/".$row['id']); ?>"><?php echo $row['subject'] . " " . $row['message']; ?></a></a></div></td>
    <td><?php if ($row['date_sent'] == date('Y-m-d')) { echo $row['time_sent']; } else echo $row['date_sent']; ?></td>
  </tr>
<?php endforeach; ?> 
</table>

Bu hat benim gerçek görünümü sayfada tekrarlanan varlık değildir:

<td width="5%"><input name="sunny" id="sunny" type="checkbox" value="" class="" checked="checked" /></td>

Temelde bunun bir bilet görüntüsü veya bir unticked resme tıklandığında olduğunda değişiklikleri bir onay kutusu için bir resim değiştirme bulunuyor.

Bu görüntü sadece benim veritabanında ilk iade mesajı ortaya çıkıyor. Benim veritabanından yakaladı olan diğer 4 iletileri onay kutusunu göstermek ve sadece diğer her mesaj için ilk mesajı gibi bir görüntü onay kutusu olmalı, çünkü bu yanlış. Bu foreach döngüsü dahil olmadığını doğrultusunda işlemek için herhangi bir php olmadığından ben tahmin ediyorum.

Bu resmi onay kutusunun amacı, kolay kullanıcıların favori için ayarladığınız kendi gelen ne mesajlar tanımak için yapmaktır.

Bunu nasıl çözersiniz?! [Alt text] [1]

0 Cevap