I had a look at the other answers in relation to mysql join and am still a little confused as to whether i'm using it right for the right instance.
I have a query that I need to perform over multiple tables at the same time and keep getting told that my statement is ambiguous.
I have 4 tables... trecord, thours, torders and tphotos
The trecord table has it's own autonumber called bid, and all the other tables have their own autonumber as well as a bid column. The trecord table will only ever have one record that needs to be retrieved at a time as does the thours table, but the torders and tphotos table will more often than not have multiple records in them that will tie back to the trecord to always show the company info.
How can I bring together all the information from trecord and thours as well as all of the information from torders and tphotos that match the bid?
$id = isset($_POST['bid']) ? $_POST['bid'] : isset($_GET['bid']) ? $_GET['bid'] : null;
$sql = "SELECT * FROM torders
INNER JOIN trecord ON torders.bid=trecord.bid
INNER JOIN thours ON thours.bid=trecord.bid
INNER JOIN tphotos ON tphotos.bid=trecord.bid
FROM WHERE bid='" . mysql_real_escape_string($id) . "'";
FROM)?nullor missing data.