Search code examples
phpmysqlshow

Show sub-data in each data with php


I'm trying to solv this issue. I have this php code.

<?php
    if (count($Modulos)>0){

        for ($x=0; $x<count($Modulos); $x++){

            // SOME CODE, to define variables

$controller = 1;
require_once "../controller/moduloController.php";
for ($z=0; $z<count($ActividadesMOD); $z++){
    echo $ActividadesMOD[$z]['actividad']. "<br/>"; 
}

?>
  <tr height="35">

        <td align="center"> <strong><?php echo $modulo;?> </strong></td>
        <td align="center"> <?php echo $encargado[0];?> </td>
        <td align="center" valign="middle"> <?php echo $deadline;?>  
                &nbsp; 
           <a href="javascript:VerDeadline(<?php echo $idmodulo;?>, '4','<?php echo $deadline;?>',  '<?php echo $modulo;?>', '<?php echo $finalizado;?>')" onClick="">
                <img src="../img/zoom-icon.png" width="17" height="17" align="absbottom">
           </a>
        </td>
        <td align="center"> <strong> <?php echo $avance . " %";?></strong></td>
        <td align="center"> <img src="<?php echo $img;?>" width="28" height="15" title="<?php echo $ttl;?>" /> </td>
        <td width="7%" align="center"> </td>

  </tr>
<?php   } 
    } else { ?>

    <tr height="30" style="font-size:11px" >

            <td align="center" colspan="5"> [ NO HAY REGISTROS ] </td>

  </tr>

<?php } ?>

Result:

enter image description here

Now, each MODULO has ACTIVIDADES (activities) that i need to show below it.

In the image above, it displays the ACTIVITIES from the MODULO 1 and not the other ones.

Taking the example from other page, should be like this: enter image description here


Solution

  • I got it !!

    Changing the require_once for include.

    The result with some css:

    enter image description here

    Greetings.