PHP: html table layout with data coming from query -


i'm trying fix layout of data coming database in way:

the query returning names of games , points awarded each game.

the layout need that:

in 1 row name of game , in row below points, 2 columns , carriage break until results displayed.

please see image, it'll show light:

http://217.116.9.130/wordpress/htmltablefromquery.gif

what have done far following code, cannot display layout needed.

![<?php  echo "<table border=1><tr>";          $count=0;             $sql2 = "select * games";                 $res2= $db_class->select($sql2);                       if (mysql_num_rows($res2)>0) {                    while($row2 = $db_class->get_row($res2)){                        $gname = $row2['gamename'];                       $gpoints = $row2['gamepoints'];                         $count++;                            echo"<td>".$gname."</td>";                        if($count % 2 != 0)                        {                         echo "</tr><tr>";                          echo"<td>".$gpoints."</td>";                        }                }            }   echo "</tr></table>";   ?> 

what divs?

<?php  echo "<table border=1><tr>";          $count=0;             $sql2 = "select * games";                 $res2= $db_class->select($sql2);                       if (mysql_num_rows($res2)>0) {                    while($row2 = $db_class->get_row($res2)){                        $gname = $row2['gamename'];                       $gpoints = $row2['gamepoints'];                         $count++;                            echo"<td>                         <div class=\"gname\">".$gname."</div>                         <div class=\"gpoints\">".$gpoints."</div>                         </td>";                        if($count % 2 != 0)                        {                         echo "</tr><tr>";                        }                }            }   echo "</tr></table>";   ?> 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -