Jump to content

Automatically changing the row when table is result of a loop


aashcool198

Recommended Posts

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.