title: PHP mysqli_fetch_assoc for two independent query
body: <p>I found that there are some related issue on mysqi_fetch_assoc online.<br>
  But my question is different from them, I do not execute two similar query or loop similar array, so not data_seek pointer helps.  </p>
  
  <p>Please hear me out, I have two different queries, execute on two different tables, so they are independent. Then I noticed that the second query will never been properly executed.   I tried switching both queries then noticed that only first one will be execute.<br>
  So I created 'myArrayA' to store some information, so I could know where and how it caused that, that's when I noticed the second while loop will be entirely being skipped, with the if else statement, so no '$sql' will be assigned to. </p>
  
  <p>I also tried changing one of the mysqi_fetch_assoc to mysqi_fetch_array, still the same. Is it the referencing problem ?<br>
  I am new to this, kindly let me know if there is any document I overlooked,that there is some similar issue with solution, I will close the question if there is any. </p>
  
  <p>P/S: I can update the full query if it is needed when I am back to work</p>
  
  <pre><code> $sql_A = "some query from table A;";
   $result_A = mysqli_query($con, $sql_A);
  
   while($row_A = mysqli_fetch_assoc($result_A)){
   if ($row_A['myguest'] == "")
   {       
        array_push($mystdclass-&gt;myArrayA, $row_A['myguest']);
        array_push($mystdclass-&gt;myArrayA, "if in rowA");
  
        $sql = "query;";
   }
   else 
   {
        array_push($mystdclass-&gt;myArrayA, $row_A['myguest']);
        array_push($mystdclass-&gt;myArrayA, "else in rowA");
  
        $sql = "query;";
   }
   }
  
   $result = mysqli_query($con, $sql);
   array_push($mystdclass-&gt;myArrayA, "result A in");
  
   while($row = mysqli_fetch_object($result)){
        array_push($mystdclass-&gt;myArrayA, $sql);
        array_push($mystdclass-&gt;myArrayA, $row-&gt;something);
        array_push(($mystdclass-&gt;infoArray, array(something from the query);
   }
  
   array_push($mystdclass-&gt;myArrayA, "A out");
   $sql_B = "some query on table B;";
   $result_B = mysqli_query($con, $sql_B);
   array_push($mystdclass-&gt;myArrayA, $sql_B);
  
   while($row_B = mysqli_fetch_object($result_B)){
        array_push($mystdclass-&gt;myArrayA, "before B while");
  
        if ($row_B['mycustomer'] == "")
        {
             array_push($mystdclass-&gt;myArrayA, "cust if in");           
             $sql_cust = "some query;";
  
        }
        else 
        {
             array_push($mystdclass-&gt;myArrayA, "cust else ");
             $sql_cust = "query;";
        }
   }
   $result_cust = mysqli_query($con, $sql_cust);
   array_push($mystdclass-&gt;myArrayA, "cust end while in");
   array_push($mystdclass-&gt;myArrayA, $sql_cust);
   while($row_cust = mysqli_fetch_object($result_cust)){
        array_push($mystdclass-&gt;myArrayA, "whats here");
        array_push($mystdclass-&gt;myArrayA, $row_cust-&gt;somethingcustomer);
        array_push($mystdclass-&gt;customer_group, array(some array in B));
    }
  
   array_push($mystdclass-&gt;myArrayA, "out out");
  </code></pre>