title: Transpose rows in columns with data from MySQL to PHP
body: <p>I need your help, I have this table (image) and I want to put that data in columns per row like this <a href="http://fiddle.jshell.net/MetCastle/WqqJq/" rel="nofollow noreferrer">fiddle</a>, but I don't know how, I only know display in the same way like db table (rows).
  You know how can I do that? </p>
  
  <p><img src="https://i.stack.imgur.com/KpnnH.jpg" alt="enter image description here"></p>
  
  <p>This is the way for show data from MySQL that I use:</p>
  
  <pre><code>&lt;?php 
      $sqlStr = "SELECT items.CA_id, items.item_id, items.item_Cant, items.CECO_cod,      items.item_desc, items.item_enduser
  FROM items where CA_id = ".$CA_id;
      $sqlStrAux = "SELECT count(*) as total FROM items";
  
  $aux = Mysql_Fetch_Assoc(mysql_query($sqlStrAux));
  $query = mysql_query($sqlStr);  
  
      if($aux['total']&gt;0){
  
          echo "&lt;/br&gt;&lt;/br&gt;";
          echo "&lt;div class='datagrid'&gt;";
          echo "\t&lt;table class=\"tablesorter\"&gt;\n";
          echo "&lt;thead&gt;";
          echo "&lt;tr&gt;
                  &lt;th&gt;Item&lt;/th&gt;
                  &lt;th&gt;Cantidad&lt;/th&gt;
                  &lt;th&gt;CECO&lt;/th&gt;
                  &lt;th&gt;Descripción de solicitud&lt;/th&gt;
                  &lt;th&gt;Usuario final&lt;/th&gt;              
                &lt;/tr&gt;\n";
          echo "&lt;/thead&gt;";      
          echo "&lt;tbody&gt;";
          while($row = mysql_fetch_assoc($query)){
        echo "\t\t&lt;tr&gt;
                      &lt;td&gt;".htmlentities($row['item_id'])."&lt;/td&gt;
                      &lt;td&gt;".htmlentities($row['item_Cant'])."&lt;/td&gt;
                      &lt;td&gt;".htmlentities($row['CECO_cod'])."&lt;/td&gt;
                      &lt;td&gt;".$row['item_desc']."&lt;/td&gt;
                      &lt;td&gt;".$row['item_enduser']."&lt;/td&gt;
                  &lt;/tr&gt;\n";
      }
          echo "&lt;/tbody&gt;";                  
          echo "\t&lt;/table&gt;\n";
      }
          echo "&lt;/div&gt;";
  ?&gt;
  </code></pre>
  
  <p>I hope you understand, thanks.</p>