sorry, in my prvious post, the second table query after union is little messed up. here is the correct one
$query="SELECT 'cid' as cid1,'position' as position1,'name' as name1,'dob' as dob1,'phone' as phone1,'education' as education1,'experience' as experience1,'salary' as salary1,'date' as date1,'candidates' as tbl1
FROM candidates INNER JOIN approvals
ON candidates.cid = approvals.cid
SELECT 'cid' as cid2,'position' as position2,'name' as name2,'dob' as dob2,'phone' as phone2,'education' as education2,'experience' as experience2,'salary' as salary2,'date' as date2,'candidates_ans' as tbl2
FROM candidates_ans INNER JOIN approvals_ph_ans
ON candidates_ans.cid = approvals_ph_ans.cid
now it works fine!!! great lesson!