Je ne suis pas sûr de savoir à quel point cela est difficile, mais j'ai un tableau et je voudrais le mettre dans une table html. je dois avoir deux chaînes de tableau par ligne, donc si tel était le tableau:Générer une table à partir d'un tableau PHP
$array1 = array(
1 => 'one',
2 => 'two',
3 => 'three',
4 => 'four',
5 => "five",
6 => 'six',
);
Et je besoin du tableau html pour ressembler à ceci:
| one | two |
|three| four |
|five | six |
Voici mon code:
$db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
$db->connect();
$sql = "SELECT ID, movieno
FROM movies
ORDER BY ID DESC
LIMIT 6 ";
$rows = $db->query($sql);
print '<table width="307" border="0" cellspacing="5" cellpadding="4">';
while ($record = $db->fetch_array($rows)) {
$vidaidi = $record['movieno'];
print <<<END
<tr>
<td>
<a href="http://www.youtube.com/watch?v=$vidaidi" target="_blank">
<img src="http://img.youtube.com/vi/$vidaidi/1.jpg" width="123" height="80"></a>
</td>
</tr>
END;
}
print '</table>';
Je veux le mettre sur deux colonnes.
si j'imprimer OU $ record i get: Resource id # 5 si je print $ vidaidi je reçois Array ([ID] => 61 [movieno] => VpWnUkUdUA) hmmm .. je recive seulement 1 rangée dans le tableau! comment extraire toutes les données dans 1 tableau? – robertdd