aashcool198 Posted June 1, 2009 Share Posted June 1, 2009 This code gives me a table which stores a parent skill and its children skills in a row. like this Net PHP joomla MVC .Net 1.0 PHP3.5 joomla1 MVC1.5 .Net 2.1 joomla2 MVC2.0 .Net 3.0 This is just one row of table. This code would create as many columns as there are number of major skills but i want the major skill coming after MVC should automatically go in next row. Basically i don't want more than four columns. How can put this condition in code? <table align = "center" border = "1" cellspacing = "10"> <tr> <?php while($row = mysql_fetch_array($result)) { $skill_id = $row['skill_id']; $result2 = mysql_query("SELECT * FROM skills where skill_id = $skill_id && parent = 'm'"); while ($row2 = mysql_fetch_array($result2)) { $result1 = mysql_query("SELECT * FROM skills where parent = $skill_id"); ?> <td> <a href="#" class="menu1" "><b><?php echo $row2['skill'] ?></a><br> <div id="123" > <?php while ($row1 = mysql_fetch_array($result1)){ ?> <a href="#" class="submenu"><?php echo $row1['skill'] ?> </a> <?php } ?> </div> </td> <?php } } ?> </tr> Quote Link to comment https://forums.phpfreaks.com/topic/160457-automatically-changing-the-row-when-table-is-result-of-a-loop/ Share on other sites More sharing options...
aashcool198 Posted June 2, 2009 Author Share Posted June 2, 2009 can please anyone help me with this? Quote Link to comment https://forums.phpfreaks.com/topic/160457-automatically-changing-the-row-when-table-is-result-of-a-loop/#findComment-847685 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.