PHP ile HTML ile do-while

0 Cevap php

Ben bir HTML tablosu oluşturmak için bir dizi döngü PHP kod yazmaya çalışıyorum. Ben böyle bir şey yapmak için çalışıyorlar:

<div id="results">
<table class="sortable">
    <?php $results = $statement->fetchAll(PDO::FETCH_ASSOC); ?>
    <?php do: ?>
        <tr>
            <?php for ($i = 0; $i < count($columns); $i++): ?>
                 <td><?php echo $row[$i] ?></td>
            <?php endfor; ?>
        </tr>
    <?php while (($row = next($results)) != false); ?>
</table>
</div>

Yani 2 soru:

  1. Is there an equivalent do-while syntax as there is a for, if, or foreach syntax in PHP, where you can split the PHP code up and have HTML in between?

  2. What is this called when you split PHP code up with HTML in between? (if there is a special term for it)

0 Cevap