mysql_field_table Function in PHP
What is mysql_field_table() function in PHP?
How does mysql_field_table works?
Explanation
mysql_field_table() function returns the table name of specified field in the result set.
Syntaxstring mysql_field_table ( resource result, int field_offset)
Returns the table name of a specified field name on success, or FALSE on failure
mysql_field_table() function returns the name of the table where a specified field is located. Field can be specified by passing result set returned by
mysql_query() and field index. mysql_field_table() function find and returns table name of field specified by the field index. Field index value starts from '0'.
Example:
<?php // Attempt to connect to the default database server $link = mysql_connect("mysql_host", "mysql_user", "mysql_password") or die ("Could not connect"); //select database $db_select = mysql_selectdb("mydb",$link); //returns result set on executing the query $result=mysql_query("select * from content",$link); //Find and returns the table name of specified field $table = mysql_field_table($result, 1); echo "Table Name of specified field: $table"; mysql_close($link); ?> |
RESULT:
Table Name of specified field: Content