title: PHP, MySQL Per row output
body: <p>Been all over the place and spent 8 hours working loops and math...still cant get it...</p>
  
  <p>I am writing a CP for a customer.  The input form will allow them to add a package deal to their web page.  Each package deal is stored in mysql in the following format</p>
  
  <p>id    header    item1    item2    item3...item12    price    savings</p>
  
  <p>The output is a table with 'header' being the name of the package and each item being 1 of the items in the package stored in a row within the table, then the price and amount saved (all of this is input via a form and INSERT statement by the customer, that part works) stored rows as well.</p>
  
  <p>Here is my PHP:</p>
  
  <pre><code>include 'dbconnect.php';
  
  $query = "SELECT * FROM md ";
  $result = mysql_query($query);
  while ($row = mysql_fetch_array($result)) {
  
        //Print 4 tables with header, items, price, savings
        //Go to next row (on main page) and print 4 more items
        //Do this until all tables have been printed
  }
  mysql_free_result($result);
  mysql_close($conn);
  </code></pre>
  
  <p>Right now the main page is simpley a header div, main div, content wrap and footer div.</p>
  
  <p>Ideal HTML output of a 'package' table, not perfect and a little confusing</p>
  
  
    $header
      $item1
      $item2
      ect...
      $price$savings
  
  
  <p>I basically want the PHP to print this 4 times per row on the main page and then move to the next row and print 4 times and continue until there are no more items in the array.  So it could be row 1 4 tables, row 2 4 tables, row 3 3 tables.</p>
  
  <p>Long, confusing and frustrating.  I about to just do 1 item per row..please help</p>
  
  <p>Jake</p>