Thanks Pjotr for the quick response. Unfortunately
mysql_db_name() will only show me the Database that I am
connected to. It will not display the database that a
resultant column is coming from.
Some of my queries span databases. A made up example
follows:
SELECT database1.some_table.column1,
database1.some_table.column2, database2.some_table.column1
FROM database1.some_table, database2.some_table
WHERE database1.some_table.id = database2.some_table.id
I would like to put the results in an associative array -
but just using table name and column name is not enough for
the key - as there could be tables from two databases with
the same name.
Thanks!
CF
"Pjotr Wedersteers" <pj***@wedersteers.com> wrote in message
news:41***********************@news.xs4all.nl...
ChronoFish wrote: In PHP you can retrieve the table.column name of a MySQL
query doing
something like this:
$result = mysql_query($query, $dbConnection);
$resultArray = mysql_fetch_row($result);
$i = 0;
foreach ($resultArray as $data)
{
$tableName = mysql_field_table($result, $i);
$fieldName = mysql_field_name($result, $i);
$returnVal["$tableName.$fieldName"] = $data;
$i += 1;
}
use mysql_db_name ($dbConnection)
HTH
Pjotr
PS mysql_dbname () can be used still, but is deprecated,
so make sure you use both underscores.