Two tables have a column called "title" and so row['title'] is ambiguous and just seems to pick one of the results at random (PHP/MYSQL). Is there a way around this or do I have to make sure my columns are distinctly named even when they are in different tables?
EDIT :
To be clear I need the title field from BOTH tables. The question is: After selecting with table1.title
, table2.title
How do I access them in $row
as 开发者_JAVA技巧in
$row = mysql_fetch_assoc($result)
? $row['title']
is ambiguous. Thanks!
You should be able to use column aliases in this case as explained here
Try aliasing the column:
SELECT A AS B
FROM TABLE
try syntax like this
Select * from tableA where tableA.title=x
精彩评论