mysql_field_table

(PHP 3, PHP 4, PHP 5)

mysql_field_table --  Возвращает название таблицы, которой принадлежит указанное поле.

Описание

string mysql_field_table ( resource result, int field_offset )

Возвращает название таблицы, которой принадлежит указанное поле.

Для совместимости доступна к использованию функция mysql_fieldtable(). Однако, использовать её крайне не рекомендуется.



mysql_field_table
me at thomaskeller dot biz
23-Nov-2005 01:15
Beware that if you upgrade to MySQL 5 from any earlier version WITHOUT dumping and reloading your data (just by keeping the binary data in MyISAM table files), you might get weird output on the "table" value for mysql_fetch_field and in this function. Weird means that the table name is randomly set or not.

This behaviour seems to popup only if the SQL query contains a ORDER BY clause. A bug is already reported:

http://bugs.mysql.com/bug.php?id=14915

To prevent the issue, dump and reload all participating tables in your query or do

CREATE TABLE tmp SELECT * FROM table;
DROP TABLE table;
ALTER TABLE tmp RENAME table;

on each one via commandline client.
cptnemo
14-Aug-2004 07:18
When trying to find table names for a (My)SQL query containing 'tablename AS alias', mysql_field_table() only returns the alias as specified in the AS clause, and not the tablename.

<mysql_field_seekmysql_field_type>
 Last updated: Tue, 15 Nov 2005