PHP's MySQL driver includes the highly useful mysql_field_table() function which returns the name of the table that the specified field is in e.g.
$q = mysql_query("
select * from MyTable inner join YourTable
on MyTable.MyIndex = YourTable.MyLink
");
$r = mysql_fetch_array($q);
for ($n = 0; $n < mysql_num_fields($r); $n++)
{
echo mysql_field_table($r, $n) . "." . mysql_field_name($r, $n)
. "<br>\n";
}
Which will list all the fields and show what table they are in.
How can I do this with the ODBC driver? Odbc_columns() is almost entirely useless for this.
(Why don't I know what table the field is in? Well, of course I do but if the database knows then PHP should be able to find it out, right?)
Kind regards.