In PHP you can retrieve the table.column name of a MySQL
query doing
something like this:
$result = mysql_query($qu ery, $dbConnection);
$resultArray = mysql_fetch_row ($result);
$i = 0;
foreach ($resultArray as $data)
{
$tableName = mysql_field_tab le($result, $i);
$fieldName = mysql_field_nam e($result, $i);
$returnVal["$tableName.$fi eldName"] = $data;
$i += 1;
}
The problem is that I am selecting across databases and it
is
conceivable that two tables will have the same name. How do
I get the
Database Name for a given field?
I would want something like this:
foreach ($resultArray as $data)
{
$dbName = mysql_field_db( $result, $i);
$tableName = mysql_field_tab le($result, $i);
$fieldName = mysql_field_nam e($result, $i);
$returnVal["$dbName.$table Name.$fieldName "] = $data;
$i += 1;
}
Any suggestions?
Thanks!
CF
Comment