pablo1988 Posted April 12, 2012 Share Posted April 12, 2012 Can anybody see how to fix the table below. My results are being stacked horizontally rather than vertically. I have attached a picture for you to see what I mean. Thanks //SKILL - query the database table $sql="SELECT Skill_Name, Rating FROM resource_skill ln inner join skill n on ln.Skill_ID = n.Skill_ID WHERE ln.Resource_ID=" . $contactid; //SKILL - run the query against the mysql query function $result=mysql_query($sql) or die(mysql_error() . '<br />' . $sql); echo "<table id=skill>"; echo "<tr>"; echo "<th>Skill</th>"; echo "<th>Rating</th>"; echo "</tr>"; //create while loop and loop through result set while($row=mysql_fetch_array($result)){ $Skill_Name=$row['Skill_Name']; $Rating=$row['Rating']; //display the result of the array echo "<ul>\n"; echo "<td>" . "" .$Skill_Name . " <td>" . $Rating . "</td></td>\n"; echo "</ul>"; } } echo "</tr>"; echo "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/260808-simple-table-problem/ Share on other sites More sharing options...
batwimp Posted April 12, 2012 Share Posted April 12, 2012 You need to have <tr> and </tr> INSIDE your while loop. Also, Is one of those brackets } without a mate? Quote Link to comment https://forums.phpfreaks.com/topic/260808-simple-table-problem/#findComment-1336707 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.