How could I compare these database values in PHP?

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2011-01-30T15:19:03Z Indexed on 2011/01/30 15:25 UTC
Read the original article Hit count: 122

Filed under:
|

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.

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?

So it would be like:

$A = $_POST['a'];
$sql = "SELECT a, aID from TABLEA WHERE a = $A";

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?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql