-1
well I am making a php dynamic menu where I would not use query within another, I am currently searching from the CATEGORY table the name of the category and within it I am searching in another PAGE table the results that have in the category field the same that has in the CATEGORY table. Is there anything that shortens this code ? or query way directly in the table that can give the same result?
Menu example:
   // primeira consulta pego da tabela categoria todos os tipos de categorias que existe
   $results = mysqli_query($db, "SELECT * FROM categorias");
   //faco o loop
   while ($row = mysqli_fetch_array($results)) { 
   // defino a categoria 
   $categoria = $row['titulo'];?>
    // imprimo o nome do menu
   <li> <a href="#homeSubmenu" data-toggle="collapse" aria-expanded="false">
         <?php echo $row['titulo']; ?></a>
    /// abro a categoria sub menu
    <ul class="collapse list-unstyled" id="homeSubmenu">
    // faco a segunda consulta
    <? $results = mysqli_query($db, "SELECT * FROM paginas WHERE categoria = '$categoria' ");
    while ($row = mysqli_fetch_array($results)) { ?>
    <li><a href="#"><?php echo $row['titulo']; ?></a></li>
    // fecho as 2 consultas
    <?php }} ?>
Oh yes as for the title QUERY WITH PAUSE, it was something I thought could give a certain type to each result of the first query run the second automatically, the logic seems simple more complicated execution ta.
Use a JOIN.
– bfavaretto