$sql="select * from a INNER JOIN b
ON a.id_a = b.id_b";
$query=mysql_query($sql);
while($arr=mysql_fetch_array($query)){
$id_b=$arr['id_b'];
}
$sql_="select * from a INNER JOIN c
ON a.id_a = c.id_c";
$query_=mysql_query($sql_);
while($arry=mysql_fetch_array($query_)){
$id_c=$arr['id_c'];
}