PHP mysql_field_table() Function

Definition and Usage

The mysql_field_table() function returns the table name where the specified field is located.

If successful, it returns the table name of the specified field, if failed, it returns false.

Syntax

mysql_field_table(data,field_offset)
Parameter Description
data Required. The data pointer to be used. The data pointer is from mysql_query() The result returned.
field_offset Required. Indicates from which field to start returning. 0 indicates the first field.

Example

<?php
$con = mysql_connect("localhost", "hello", "321");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
$db_selected = mysql_select_db("test_db",$con);
$sql = "SELECT * from Person";
$result = mysql_query($sql,$con);
$table = mysql_field_table($result, 0);
echo $table;
mysql_close($con);
?>

Output:

Person