title: How could I compare these database values in PHP?
body: <p>So a user selects from a drop down list a value. I take this value, put it into a variable, then select from the database the ID value of that table A holding the selected value also.</p>
  
  <p>So now I'm trying to use that ID value to get to a many-to-many relationship table that has the selected value from table A to a different table B. The many-to-many relationship table has both IDs. How can I compare this using PHP?</p>
  
  <p>So it would be like:</p>
  
  <pre><code>$A = $_POST['a'];
  $sql = "SELECT a, aID from TABLEA WHERE a = $A";
  </code></pre>
  
  <p>What do I do then to compare the aID with the many-to-many relationships table, then get the other ID in that table and then take that ID to get values from table B?</p>