<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.mysql.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.mysql-field-table.php',
    1 => 'mysql_field_table',
    2 => 'Get name of the table the specified field is in',
  ),
  'up' => 
  array (
    0 => 'ref.mysql.php',
    1 => 'MySQL Functions',
  ),
  'prev' => 
  array (
    0 => 'function.mysql-field-seek.php',
    1 => 'mysql_field_seek',
  ),
  'next' => 
  array (
    0 => 'function.mysql-field-type.php',
    1 => 'mysql_field_type',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mysql/functions/mysql-field-table.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mysql-field-table" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mysql_field_table</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">mysql_field_table</span> &mdash; <span class="dc-title">Get name of the table the specified field is in</span></p>

 </div>

 <div id="function.mysql-field-table-refsynopsisdiv">
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="para">This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0.
Instead, the <a href="book.mysqli.php" class="link">MySQLi</a> or <a href="ref.pdo-mysql.php" class="link">PDO_MySQL</a> extension should be used.
See also <a href="mysqlinfo.api.choosing.php" class="link">MySQL: choosing an API</a> guide.
Alternatives to this function include:</p>
   <ul class="simplelist">
    <li><span class="function"><a href="mysqli-result.fetch-field-direct.php" class="function">mysqli_fetch_field_direct()</a></span> [table] or [orgtable]</li>
    <li><span class="methodname"><a href="pdostatement.getcolumnmeta.php" class="methodname">PDOStatement::getColumnMeta()</a></span> [table]</li>
   </ul>
  </div>
 </div>

 <div class="refsect1 description" id="refsect1-function.mysql-field-table-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mysql_field_table</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$result</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$field_offset</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="simpara">
   Returns the name of the table that the specified field is in.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mysql-field-table-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   <dt>
<code class="parameter">result</code></dt><dd><p class="para">The result <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> that
is being evaluated. This result comes from a call to
<span class="function"><a href="function.mysql-query.php" class="function">mysql_query()</a></span>.</p></dd>
   <dt>
<code class="parameter">field_offset</code></dt><dd><p class="para">The numerical field offset. The
<code class="parameter">field_offset</code> starts at <code class="literal">0</code>. If
<code class="parameter">field_offset</code> does not exist, an error of level
<strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> is also issued.</p></dd>
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mysql-field-table-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="simpara">
   The name of the table on success.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.mysql-field-table-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 A <span class="function"><strong>mysql_field_table()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$query </span><span style="color: #007700">= </span><span style="color: #DD0000">"SELECT account.*, country.* FROM account, country WHERE country.name = 'Portugal' AND account.country_id = country.id"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// get the result from the DB<br /></span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">mysql_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$query</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Lists the table name and then the field name<br /></span><span style="color: #007700">for (</span><span style="color: #0000BB">$i </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">; </span><span style="color: #0000BB">$i </span><span style="color: #007700">&lt; </span><span style="color: #0000BB">mysql_num_fields</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">); ++</span><span style="color: #0000BB">$i</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">$table </span><span style="color: #007700">= </span><span style="color: #0000BB">mysql_field_table</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">, </span><span style="color: #0000BB">$i</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">$field </span><span style="color: #007700">= </span><span style="color: #0000BB">mysql_field_name</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">, </span><span style="color: #0000BB">$i</span><span style="color: #007700">);<br /><br />    echo  </span><span style="color: #DD0000">"</span><span style="color: #0000BB">$table</span><span style="color: #DD0000">: </span><span style="color: #0000BB">$field</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 notes" id="refsect1-function.mysql-field-table-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    For backward compatibility, the following
deprecated alias may be used: 
    <span class="function"><strong>mysql_fieldtable()</strong></span>
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.mysql-field-table-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.mysql-list-tables.php" class="function" rel="rdfs-seeAlso">mysql_list_tables()</a> - List tables in a MySQL database</span></li>
  </ul>
 </div>

</div><?php manual_footer($setup); ?>