Forum und email

mysql_field_table

(PHP 4, PHP 5, PECL mysql:1.0)

mysql_field_table — Get name of the table the specified field is in

說明

string mysql_field_table ( resource $result , int $field_offset )

Returns the name of the table that the specified field is in.

參數

result

回傳類型為 resource 的結果集。該結果集從 mysql_query() 的呼叫中得到。

field_offset

數字形式的欄位偏移量。field_offset 開始於 0。如果 field_offset 不存在,系統會發出 E_WARNING 級別的警告信息。

Return值

The name of the table on success.

範例

Example#1 A mysql_field_table() example

<?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";
}

?>

註釋

Note: 為了保證向下相容性,可以使用下面的別名,但不贊成使用它: mysql_fieldtable()