Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Answer has been updated for adjusted original post requirements as follows:</p> <p>this is a wierd (or elegant) way to get what you want done and it will likely take tweaking to get it to look pretty, but it seems to work as you can see at the following url</p> <p><a href="http://www.bluevineconsulting.com/table_test.php" rel="nofollow">http://www.bluevineconsulting.com/table_test.php</a></p> <p>it has the php div method on top and does indeed show that the div's are different sizes as you had hoped would not happen. I have however come up with elegant/ugly solution that works with a table.</p> <pre><code>// i populated a fake object so i could test with it $data = new stdClass(); $data-&gt;student1-&gt;id = "1"; $data-&gt;student1-&gt;name = "Test1"; $data-&gt;student1-&gt;last_name = "User1"; $data-&gt;student1-&gt;gender = "Male"; $data-&gt;student2-&gt;id = "2"; $data-&gt;student2-&gt;name = "Test"; $data-&gt;student2-&gt;last_name = "User&lt;br&gt;\nMaiden&lt;br&gt;\nOther\n"; $data-&gt;student2-&gt;gender = "Female"; $data-&gt;student3-&gt;id = "3"; $data-&gt;student3-&gt;name = "Test3"; $data-&gt;student3-&gt;last_name = "User3"; $data-&gt;student3-&gt;gender = "Male"; $data-&gt;student4-&gt;id = "4"; $data-&gt;student4-&gt;name = "Test4"; $data-&gt;student4-&gt;last_name = "User4"; $data-&gt;student4-&gt;gender = "Female"; $data-&gt;student5-&gt;id = "5"; $data-&gt;student5-&gt;name = "Test5"; $data-&gt;student5-&gt;last_name = "User5"; $data-&gt;student5-&gt;gender = "Female"; $data-&gt;student6-&gt;id = "6"; $data-&gt;student6-&gt;name = "Test6"; $data-&gt;student6-&gt;last_name = "User6"; $data-&gt;student6-&gt;gender = "Female"; $datacount = count($data); foreach($data as $row) { $datacount++; if (empty($colcount)) { foreach ($row as $key =&gt; $val) { $colcount++; $keyname[$colcount] = $key; } echo "Columns = ".$colcount."&lt;br&gt;\n"; } } echo "records = ".$datacount."&lt;br&gt;\n&lt;br&gt;\n"; echo ("&lt;b&gt;PHP Table method:&lt;/b&gt;&lt;br&gt;\n&lt;br&gt;\n"); echo ("&lt;table border='1px' cellspacing='0'&gt;\n"); foreach ($keyname as $key) { echo " &lt;tr style='vertical-align:top;'&gt;\n"; for ($d = 1; $d &lt; $datacount; $d++) { $id = "student".$d; echo " &lt;td&gt;".$data-&gt;$id-&gt;$key."&lt;/td&gt;\n"; } echo " &lt;/tr&gt;\n"; } echo ("&lt;/table&gt;\n"); </code></pre> <p>i have to admit it is strange, but it keeps your tables with the correct heights .. the next more complicated part would be to set how many columns to show as this method makes it much more complicated to break after 5 columns like the div method I had earlier.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload