title: Looping through (and displaying) multiple table rows from SQL
body: <p>Having trouble looping through multiple rows in a SQL table and getting the info to display correctly. The closest I have got is the following:</p>
  
  <pre><code>&lt;table border="1" cellpadding="10"&gt;
  &lt;th&gt;Stock&lt;/th&gt;&lt;th&gt;Price&lt;/th&gt;&lt;th&gt;Shares&lt;/th&gt;&lt;th&gt;Value&lt;/th&gt;&lt;th&gt;Sell Stock&lt;/th&gt;
  &lt;?php
  $transactions = mysql_query("SELECT * FROM transactions WHERE email='$email'");
  while ($rows = mysql_fetch_assoc($transactions)) {
      foreach($rows as $row) {
          $symbol = $row["symbol"];
          $price = $row["price"];
          $shares = $row["shares"];
          $value = $price * $shares;
  ?&gt;
          &lt;form name="sellStock" action="sell.php" method="get"&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;input name="symbol" type="hidden" value="&lt;?php echo $symbol ?&gt;"&gt;&lt;?php echo $symbol ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input name="price" type="hidden" value="&lt;?php echo $price ?&gt;"&gt;&lt;?php echo $price ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input name="shares" type="hidden" value="&lt;?php echo $shares ?&gt;"&gt;&lt;?php echo $shares ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input name="value" type="hidden" value="&lt;?php $value ?&gt;" /&gt;&lt;?php $value ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input name="sell" type="submit" value="Sell"&gt;&lt;/td&gt;
          &lt;/tr&gt;
  &lt;?php
      }
  }
  ?&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The while/foreach loop goes on to display the info from the rows into a HTML table, but it displays the first character from every column as opposed to all the characters from the columns I echo to be displayed (symbol, price, and shares). Any ideas?</p>