PHP Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
PHP Topics
Introduction Introduction
Syntax Syntax
Data Types Data Types
Operators Operators
Control Structures Control Structures
Functions Functions
Pre-defined Function Pre-defined Function
Calendar Functions Calendar Functions
Date and Time Date and Time
Array Functions Array Functions
Array List Array Functions List1
Array Function List Array Functions List2
Math Functions Math Functions
PHP MYSQL Functions PHP Mysql Functions
File Handling File Handling
Error Handling Error Handling
DB Size DB Size
PHP Mail PHP Mail
String Tokens String Tokens
String Functions String Functions
String Functions List String Functions List1
String Functions List2 String Functions List2
Session Functions Session Functions
Cookies Functions Cookies Functions
Form Variables Form Variables
Running PHP from JS Running PHP from JS
Array To JS Array To JS
JS Array Array to PHP
Encryption Encryption
Common Header Common Header
Forums Ask Your Doubts
Scraps More about PHP
Feedback Feedback
 




mysql_field_table Function in PHP


Tutorials »Php »

Topic

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.

Syntax

string 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







Other Links

web hosting