I can currently query the join of two tables on the equality of a foreign/primary key in the following way.
$result = mysql_query(\"SELECT * FROM `table1`
SELECT table1 .columnName, table3 .columnName
FROM table1
inner join table2
ON table1.primarykey = table2.foreignkey
inner join table3
ON table2.primarykey = table3.foreignkey
for example:
Select SalesHeader.invoiceDate,ActualSales,DeptName,tblInvDepartment.DeptCode ,LocationCode from SalesDetail Inner Join SalesHeader on SalesDetail.InvoiceNo = SalesHeader.InvoiceNo inner join tblInvDepartment on tblInvDepartment.DeptCode = SalesDetail.DeptCode