title: Render SQL query results as an HTML table
body: <p>I need help rendering data in PHP:</p>
  
  <p>I want to use the results of a SQL query to populate a table, displaying images in a 4-column grid. Here's what I've written so far:</p>
  
  <pre><code>$result = mysql_query("SELECT * FROM gallery ORDER BY id ASC ");
  
  while($row = mysql_fetch_array($result))
  {
      echo "&lt;td align=\"center\" &gt;&lt;a href=\"upload_gallery/".$row['image_name']."\" rel=\"prettyPhoto[gallery1]\" title=\" \"&gt;&lt;img src=\"upload_gallery/thumbnail/sml_".$row['image_name']."\" width=\"200\" height=\"170\" /&gt;&lt;/a&gt;&lt;/td&gt;";
  } 
  </code></pre>