PHP mysql_field_table() Function Example

PHP mysql_field_table() Function Example


Posted in : PHP Posted on : February 19, 2011 at 5:41 PM Comments : [ 0 ]

Using mysql_field_table() function you can find the table name where a particular field is located.

PHP mysql_field_table() Function Example:

Using mysql_field_table() function you can find the table name where a particular field is located. It returns the name of the table of a specified field name on success or false for failure.

Example:

<?php
$connection = mysql_connect("localhost","root","root");
if (!$connection)
{
die('PHP Mysql database connection could not connect : ' . mysql_error());
}

$db_selected = mysql_select_db("php_mysql",$connection);

$sql_query = "SELECT * from user";
$result = mysql_query($sql_query, $connection);

$table_name = mysql_field_table($result, 0);

echo "Table Name : " . $table_name;

mysql_close($connection);
?> 

After running this example the browser output is:

Output:

Table Name : user

And the database 'user' table is:

Download Example Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics