ipPHPadmin Posted November 26, 2010 Share Posted November 26, 2010 Hello everyone, I'm trying to display two tables side by side in a php file. I realize this may not be the correct forum for this, but i feel like its an html issue not php. I have the code pulling all the information correctly from the database but its not displaying in tables correctly. It's currently displaying two tables side by side but with the data in 5 columns instead of 5 rows. Thanks in advance for the help. <?php $display = mysql_query("SELECT * FROM Artisan WHERE ART_ID = '".$ART_ID."'"); $numrows = mysql_num_rows($display); if($numrows == 0) { die('Could not find artisan information: ' . mysql_error()); } else { while($row = mysql_fetch_array($display)) { $A_ID = $row["ART_ID"]; $A_Name = $row["ART_Name"]; ?> <table align = "center" width = "100%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <tr> <td align="right">Artisan Name:</td> <td align="left"><?php echo $A_Name; ?> </td> </tr> <tr> <td align="right">Artisan ID:</td> <td align="left"><?php echo $A_ID; ?></td> </tr> </table> <?php $QuestionQuery = mysql_query("SELECT * FROM ArtisanQuestion ORDER BY ARQ_ID")or die ("Error retrieving artisan questions." . mysql_error()); while ($row = mysql_fetch_array($QuestionQuery)) { $QuesID = $row["ARQ_ID"]; $Ques = $row["ARQ_Question"]; ?> <table align = "left" width = "100px" height = "50px" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <tr> <td><?php echo $QuesID. ". ".$Ques; ?></td> </tr> </table> <?php } $AnswerQuery = mysql_query("SELECT * FROM ArtisanAnswer WHERE ART_ID = '".$A_ID."' ORDER BY ARQ_ID "); while ($row = mysql_fetch_array($AnswerQuery)) { $Ans = $row["ARAN_Answer"]; ?> <table align = "right" width = "100px" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <tr> <td><?php echo $Ans; ?> </td> </tr> </table> <?php } } } } ?> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 27, 2010 Share Posted November 27, 2010 I didn't go through all of the code, but you have your <table></table> tags inside the while loops, whereas you should only be echoing the <tr><td></td></tr> tags in the loop. Quote Link to comment Share on other sites More sharing options...
ipPHPadmin Posted November 28, 2010 Author Share Posted November 28, 2010 That worked. Thanks a lot. 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.