I have two tables:
table t1
color | state | id
blue | NY | 1
table t2
hair | state | id
blond | NY | 516
One column - state - is common to both tables.
To join both tables, I used this:
$query="SELECT t1.color, t1.id, t2.id FROM t1,t2 WHERE t1.state=t2.state";
$result = mysql_db_query($db,$query,$connection);
Problem:
The two tables contain a column called "id".
How do I get the values for "id" in each table using a single query?
Surprisingly to me, this did not work:
$row = mysql_fetch_array($result);
$color = $row[color];
$id1 = $row[t1.id];
$id2 = $row[t2.id];
TIA