I have 2 table and i want to pull data from both of them. This is sample for my table structure:
Table tbl_a = id, time, note, customer Table tbl_b = id, time, name, surname, note
This is my mysql request:
Select * from tbl_a left join tbl_b on tbl_a.customer=tbl.b=id where tbl_a.id=5;
When i run this query directly from mysql i can see result exactly as i want but i dont know how to display it in my php page.
i am doing it like this:
$sql = mysql_query("Select * from tbl_a left join tbl_b on tbl_a.customer=tbl.b=id where tbl_a.id=5");
$data = mysql_fetch_array($sql);
echo $data[id]." - ".$data[time]." - ".$data[note]." - ".$data[customer]." - ".$data[id]." - ".$data[name]." - ".$data[surname]." - ".$data[note];
i know that column names that are repeated could not be used again but i dont know what the right way is.