title: How to compare 2 result query with 2 while?
body: <p>I want looping with compare the first query and second query</p>
  
  <p>I have 2 result query, I want to compare if id_car in the first query that is same with id_car in the second query</p>
  
  <p>table1</p>
  
  <pre><code>id | id_car |
  =============
  1  |    1   |
  2  |    2   |
  </code></pre>
  
  <p>table2</p>
  
  <pre><code>id| id_car  |
  =============
  1 |    1    |      
  
  
  $query1=mysqli_query($koneksi,"SELECT * FROM table1");
  while($data1=mysqli_fetch_array($query1)){
  
    $query2=mysqli_query($koneksi,"SELECT * FROM table2");
      while($data2=mysqli_fetch_array($query2)){    
        if($data1['id_car'] == $data2['id_car']){
          echo "&lt;tr&gt;";
          echo "&lt;input type='checkbox' value='$data1[id_car]' 
          checked='checked'&gt;";
          echo "&lt;td&gt;$data1['id_car']&lt;/td&gt;";
          echo "&lt;/tr&gt;";
        }
      }
      echo "&lt;tr&gt;"
      echo "&lt;input type='checkbox' value='$data1[id_car]'&gt;";
      echo "&lt;td&gt;$data1['id_car']&lt;/td&gt;"
      echo "&lt;/tr&gt;"
  }
  </code></pre>
  
  <p>I got output </p>
  
  <pre><code>checkbox  | id_car  |
     ✓         1    
               1    
               2
  </code></pre>
  
  <p>i want to output when data1['id_car'] == data2['id_car'] just show 1 data with checked like this :</p>
  
  <pre><code>checkbox  | id_car  |
     ✓         1       
               2
  </code></pre>
  
  <p>can someone help me, sir? I will appreciate if someone wants to help me :(
  i try to not use SQL left join
  and i want to learn to use 2 while with compare value</p>