<?php
include("conexion.php");
$r1 = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=0 ORDER BY prdfam_nombre;");
while($row1 = mysqli_fetch_array($r1)){
	$xprdfam_codi_1 = $row1['prdfam_codi'];
	?>
	<div style="clear:both;">
	<div align="center"></div>
	
	<div align="left" style="float:left;" ondblclick="accion_familia('adicionar','','','','','<?php echo $row1['prdfam_codi']; ?>'); " >
		
	<?php
	echo "&nbsp; -- &nbsp;".$row1['prdfam_nombre'];
	echo "<br>";
	
		$r_producto = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=0 ORDER BY prdfam_nombre;");
		while($row_producto = mysqli_fetch_array($r1)){
			$xprdfam_codi_1 = $row1['prdfam_codi'];
		
	
		}	
	?>
	</div>
	</div>
	<?php
	//echo "<br>";
		
	$r2 = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=$xprdfam_codi_1 ORDER BY prdfam_nombre;");
	while($row2 = mysqli_fetch_array($r2)){
		$xprdfam_codi_2 = $row2['prdfam_codi'];
		//echo "__ __ ".$row2['prdfamniv_nombre'];
		//echo "<br>";
		?>
		<div style="clear:both;">

		<div align="left" style="float:left;" ondblclick="accion_familia('adicionar','','','','','<?php echo $row2['prdfam_codi']; ?>'); " >
		<?php
		echo "&nbsp; -- &nbsp; -- &nbsp;".$row2['prdfam_nombre'];
		echo "<br>";
		?>
		</div>
		</div>
		<?php


		$r3 = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=$xprdfam_codi_2 ORDER BY prdfam_nombre;");
		while($row3 = mysqli_fetch_array($r3)){
			$xprdfam_codi_3 = $row3['prdfam_codi'];			
			//echo "__ __ __ ".$row3['prdfamniv_nombre'];
			//echo "<br>";
						
			?>
			<div style="clear:both;">
			
			<div align="left" style="float:left;" ondblclick="accion_familia('adicionar','','','','','<?php echo $row3['prdfam_codi']; ?>'); " >			
			<?php
			echo "&nbsp; -- &nbsp; -- &nbsp; -- &nbsp;".$row3['prdfam_nombre'];
			echo "<br>";
			?>
			</div>
			</div>
			<?php
						

			$r4 = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=$xprdfam_codi_3 ORDER BY prdfam_nombre;");
			while($row4 = mysqli_fetch_array($r4)){
				$xprdfam_codi_4 = $row4['prdfam_codi'];
				//echo "__ __ __ __ ".$row4['prdfamniv_nombre'];
				//echo "<br>";

				?>
				<div style="clear:both;">							
				<div align="left" style="float:left;" ondblclick="accion_familia('adicionar','','','','','<?php echo $row4['prdfam_codi']; ?>'); " >				
				<?php
				echo "&nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp;".$row4['prdfam_nombre'];
				echo "<br>";
				?>
				</div>
				</div>
				<?php


				$r5 = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=$xprdfam_codi_4 ORDER BY prdfam_nombre;");
				while($row5 = mysqli_fetch_array($r5)){
					$xprdfam_codi_5 = $row5['prdfam_codi'];
					//echo "__ __ __ __ __ ".$row5['prdfamniv_nombre'];
					//echo "<br>";
					
					?>
					<div style="clear:both;">					
					<div align="left" style="float:left;" ondblclick="accion_familia('adicionar','','','','','<?php echo $row5['prdfam_codi']; ?>'); " >
					<?php
					echo "&nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp;".$row5['prdfam_nombre'];
					echo "<br>";
					?>
					</div>
					</div>
					<?php
						
					
					$r6 = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=$xprdfam_codi_5 ORDER BY prdfam_nombre;");
					while($row6 = mysqli_fetch_array($r6)){
						$xprdfam_codi_6 = $row6['prdfam_codi'];
						//echo "__ __ __ __ __ ".$row6['prdfamniv_nombre'];
						//echo "<br>";
						
						?>
						<div style="clear:both;">

						<div align="left" style="float:left;" ondblclick="accion_familia('adicionar','','','','','<?php echo $row6['prdfam_codi']; ?>'); " >						
						<?php
						echo "&nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp;".$row6['prdfam_nombre'];
						echo "<br>";
						?>
						</div>
						</div>
						<?php
												
					
						$r7 = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=$xprdfam_codi_6 ORDER BY prdfam_nombre;");
						while($row7 = mysqli_fetch_array($r7)){
							$xprdfam_codi_7 = $row7['prdfam_codi'];
							//echo "__ __ __ __ __ ".$row7['prdfamniv_nombre'];
							//echo "<br>";

							?>
							<div style="clear:both;">
														
							<div align="left" style="float:left;" ondblclick="accion_familia('adicionar','','','','','<?php echo $row7['prdfam_codi']; ?>'); " >							
							<?php
							echo "&nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp;".$row7['prdfam_nombre'];
							echo "<br>";
							?>
							</div>
							</div>
							<?php
								


							$r8 = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=$xprdfam_codi_7 ORDER BY prdfam_nombre;");
							while($row8 = mysqli_fetch_array($r8)){
								$xprdfam_codi_8 = $row8['prdfam_codi'];
								//echo "__ __ __ __ __ ".$row8['prdfamniv_nombre'];
								//echo "<br>";
								
								?>
								<div style="clear:both;">
								
								<div align="left" style="float:left;" ondblclick="accion_familia('adicionar','','','','','<?php echo $row8['prdfam_codi']; ?>'); " >								
								<?php
								echo "&nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp;".$row8['prdfam_nombre'];
								echo "<br>";
								?>
								</div>
								</div>
								<?php
																									

								$r9 = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=$xprdfam_codi_8 ORDER BY prdfam_nombre;");
								while($row9 = mysqli_fetch_array($r9)){
									$xprdfam_codi_9 = $row9['prdfam_codi'];
									//echo "__ __ __ __ __ ".$row9['prdfamniv_nombre'];
									//echo "<br>";

									?>
									<div style="clear:both;">
																	
									<div align="left" style="float:left;" ondblclick="accion_familia('adicionar','','','','','<?php echo $row9['prdfam_codi']; ?>'); " >									
									<?php
									echo "&nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp; -- &nbsp;".$row9['prdfam_nombre'];
									echo "<br>";
									?>
									</div>
									</div>
									<?php
											
										
									$r10 = mysqli_query($conexion,"SELECT * FROM productos_familia p WHERE prdfam_codi_fk_padre=$xprdfam_codi_9 ORDER BY prdfam_nombre;");
									while($row10 = mysqli_fetch_array($r10)){
										$xprdfam_codi_10 = $row10['prdfam_codi'];
										//echo "__ __ __ __ __ ".$row10['prdfamniv_nombre'];
										//echo "<br>";
										
										?>
										<div style="clear:both;">
																				
										<div align="left" style="float:left;" ondblclick="accion_familia('adicionar','','','','','<?php echo $row10['prdfam_codi']; ?>'); " >										
										<?php
										echo "&nbsp; __ &nbsp; __ &nbsp; __ &nbsp; __ &nbsp; __ &nbsp; __ &nbsp; __ &nbsp; __ &nbsp; __ &nbsp; __ &nbsp;".$row10['prdfam_nombre'];
										echo "<br>";
										?>
										</div>
										</div>
										<?php
																			
									}																																		
								}																										
							}																			
						}													
					}																
				}						
			}			
		}	
	}
}


?>
