mysql_field_table
(PHP 4, PHP 5)
mysql_field_table — 取得指定字段所在的表名
警告
本扩展自 PHP 5.5.0 起已废弃,并在自 PHP 7.0.0 开始被移除。应使用 MySQLi 或 PDO_MySQL 扩展来替换之。参见 MySQL:选择 API 指南来获取更多信息。用以替代本函数的有:
- mysqli_fetch_field_direct() [table] 或 [orgtable]
- PDOStatement::getColumnMeta() [table]
参数
-
result
resource 型的结果集。此结果集来自对 mysql_query() 的调用。
-
field_offset
数值型字段偏移量。
field_offset
从0
开始。如果field_offset
不存在,则会发出一个E_WARNING
级别的错误
返回值
The name of the table on success.
示例
示例 #1 mysql_field_table() 示例
<?php
$query = "SELECT account.*, country.* FROM account, country WHERE country.name = 'Portugal' AND account.country_id = country.id";
// get the result from the DB
$result = mysql_query($query);
// Lists the table name and then the field name
for ($i = 0; $i < mysql_num_fields($result); ++$i) {
$table = mysql_field_table($result, $i);
$field = mysql_field_name($result, $i);
echo "$table: $field\n";
}
?>
注释
注意:
为了向下兼容,可以使用下列已废弃的别名: mysql_fieldtable()
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/function.mysql-field-table.php