2017-08-07 16 views
0

どのようにして結果を得ようとしているのか理解しようとすると、1つのモノリシックな行として表示されなくなり、代わりにそれぞれの行に表示されます。今まで運が足りなかったPHP - Mysqlの結果を新しい行に表示しようとしています

$result = mysql_query("SELECT *, ROUND(score) AS performance FROM images ORDER BY ROUND(score) DESC LIMIT 11,50"); 
while($row = mysql_fetch_object($result)) { 
    $top_ratings2[] = (object) $row; 
} 


<? foreach($top_ratings2 as $key => $image) : ?> 
<td valign="top"> 
    <b><?=$image->name?></b> 
    <b>Score:</b> <?=$image->score?> 
    <b>Wins:</b> <?=$image->wins?> 
</td> 
<? endforeach ?> 
+0

https://developer.mozilla.org/en/docs/Web/HTML/Element/br – Phil

答えて

0

がテーブルを使用してみてください

<?php 
$result = mysql_query("SELECT *, ROUND(score) AS performance FROM images ORDER BY ROUND(score) DESC LIMIT 11,50"); 
while ($row = mysql_fetch_object($result)) { 
    $top_ratings2[] = (object)$row; 
} 
?> 
<table> 
    <thead> 
    <tr> 
     <td>Name</td> 
     <td>Score</td> 
     <td>Wins</td> 
    </tr> 
    </thead> 
    <tbody> 
    <?php foreach ($top_ratings2 as $key => $image) : ?> 
     <tr> 
      <td valign="top"> 
       <?= $image->name ?> 
      </td> 
      <td valign="top"> 
       <?= $image->score ?> 
      </td> 
      <td valign="top"> 
       <?= $image->wins ?> 
      </td> 
     </tr> 
    <?php endforeach ?> 
    </tbody> 
</table> 
関連する問題