kpetsche20 Posted March 5, 2008 Share Posted March 5, 2008 I'm trying to select every invoice number from my database and have each displayed in a new row. However right now all the invoice and prices are showing up as new columns. Any help. Link to output http://floridafuelinjection.com/new/index.php Code: <? $result = "SELECT * FROM name"; $query = mysql_query($result); $array = mysql_fetch_array($query); $result2 = "SELECT * FROM tax WHERE Num = ".$array['Num']." AND Memo = 'Sales Tax'"; $query2 = mysql_query($result2); $result3 = "SELECT * FROM tax WHERE Num = ".$array['Num']." AND Memo = 'Florida State Tax'"; $query3 = mysql_query($result3); for ($x=0; $x < mysql_num_rows($query); $x++) { $a = mysql_fetch_array($query); $a['Num']; $a['Amount']; $b = mysql_fetch_array($query2); $b['Amount']; $c = mysql_fetch_array($query3); $c['Amount']; echo "<td>".$a['Num']."</td> <td>".$a['Amount']."</td>"; } ?> Quote Link to comment Share on other sites More sharing options...
MmmVomit Posted March 5, 2008 Share Posted March 5, 2008 You're missing the HTML tags that define table rows. Change this: echo "<td>".$a['Num']."</td> <td>".$a['Amount']."</td>"; To this: echo "<tr><td>".$a['Num']."</td> <td>".$a['Amount']."</td></tr>"; Also: for ($x=0; $x < mysql_num_rows($query); $x++) { $a = mysql_fetch_array($query); $a['Num']; \\ this line of code does nothing $a['Amount']; \\ this line of code does nothing $b = mysql_fetch_array($query2); $b['Amount']; \\ this line of code does nothing $c = mysql_fetch_array($query3); $c['Amount']; \\ this line of code does nothing echo "<td>".$a['Num']."</td> <td>".$a['Amount']."</td>"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.