Abfrageergebnis in einer Tabelle anzeigen

Ich habe eine MySQL-Abfrage mit über 50 Rückgabeergebnissen. Jetzt muss ich die Ergebnisse in einer Tabelle mit 3 Zeilen und 3 Spalten anzeigen.

Etwas wie das:

<table>
    <tr>
        <td>Content</td>                    
        <td>Content</td>                    
        <td>Content</td>                                        
    </tr>   
    <tr>
        <td>Content</td>                    
        <td>Content</td>                    
        <td>Content</td>                                        
    </tr>   
    <tr>
        <td>Content</td>                    
        <td>Content</td>                    
        <td>Content</td>                                        
    </tr>
</table>

Ich habe es mit PHP so ausprobiert:

$q = "SELECT name, address, content FROM mytable"; 
$r = mysqli_query($dbc, $q); 

while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
    $name   = $row['name'];
    $address = $row['address'];
    $content = $row['content'];

    //Create new output
    $output  = "<p>$name</p>";
    $output .= "<p>$address</p>";
    $output .= "<p>$content</p>";

    //Add output to array
    $mycontent[] = $output;     
}

Dann drucke ich das Inhaltsarray in meiner Tabelle wie folgt aus:

<tr>
    <td><?php echo $mycontent[0]; ?></td>                   
    <td><?php echo $mycontent[1]; ?></td>                   
    <td><?php echo $mycontent[2]; ?></td>                   
</tr>   
<tr>
    <td><?php echo $mycontent[3]; ?></td>                   
    <td><?php echo $mycontent[4]; ?></td>                   
    <td><?php echo $mycontent[5]; ?></td>                                       
</tr>   
<tr>
    <td><?php echo $mycontent[6]; ?></td>                   
    <td><?php echo $mycontent[7]; ?></td>                   
    <td><?php echo $mycontent[8]; ?></td>                                           
</tr>

Mit diesem Code kann ich nur 9 Inhalte anzeigen. Mein Problem ist, dass ich mehr Inhalt anzeigen möchte. Ich werde verwendenSeitennummerierung Inhalte anzeigen; so etwas wie 0-9, 10-18, 19-27 usw.

HINWEIS: Ich kann den Paginierungsteil ausführen.

Ich hoffe jemand wird mir die richtige Richtung dafür geben.

Vielen Dank.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage