downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.mysql-tablename.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = 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-tablename.php',
   
1 => 'mysql_tablename',
  ),
 
'up' =>
  array (
   
0 => 'ref.mysql.php',
   
1 => 'MySQL Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.mysql-stat.php',
   
1 => 'mysql_stat',
  ),
 
'next' =>
  array (
   
0 => 'function.mysql-thread-id.php',
   
1 => 'mysql_thread_id',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

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

 </div>

 <a name="function.mysql-tablename.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><b>mysql_tablename</b></span>
    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$result</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$i</tt></span>
   )</div>

  <p class="para rdfs-comment">
   Retrieves the table name from a <i><tt class="parameter">result</tt></i>
.
  </p>
  <p class="para">
   This function deprecated. It is preferable to use
   <a href="function.mysql-query.php" class="function">mysql_query()</a> to issue a SQL <i>SHOW TABLES
   [FROM db_name] [LIKE &#039;pattern&#039;]</i> statement instead.
  </p>
 </div>


 <a name="function.mysql-tablename.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">result</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       A result pointer <a href="language.types.resource.php" class="type resource">resource</a> that&#039;s returned from 
       <a href="function.mysql-list-tables.php" class="function">mysql_list_tables()</a>.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">i</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The integer index (row/table number)
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.mysql-tablename.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   The name of the table on success or <b><tt class="constant">FALSE</tt></b> on failure.
  </p>
  <p class="para">
   Use the <b>mysql_tablename()</b> function to
   traverse this result pointer, or any function for result tables,
   such as <a href="function.mysql-fetch-array.php" class="function">mysql_fetch_array()</a>.
  </p>
 </div>


 <a name="function.mysql-tablename.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>mysql_tablename()</b> example</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />mysql_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"mysql_user"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"mysql_password"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_list_tables</span><span style="color: #007700">(</span><span style="color: #DD0000">"mydb"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$num_rows&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_num_rows</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br />for&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">$num_rows</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Table:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">mysql_tablename</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">mysql_free_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div><p>
  </p>
 </div>


 <a name="function.mysql-tablename.notes"></a><div class="refsect1 notes">
  <h3 class="title">Notes</h3>
  <blockquote><p><b class="note">Note</b>:
  
    The <a href="function.mysql-num-rows.php" class="function">mysql_num_rows()</a> function may be used to
    determine the number of tables in the result pointer.
   <br />
  </p></blockquote>
 </div>


 <a name="function.mysql-tablename.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.mysql-list-tables.php" class="function" rel="rdfs-seeAlso">mysql_list_tables()</a> - List tables in a MySQL database</li>
    <li class="member"><a href="function.mysql-field-table.php" class="function" rel="rdfs-seeAlso">mysql_field_table()</a> - Get name of the table the specified field is in</li>
    <li class="member"><a href="function.mysql-db-name.php" class="function" rel="rdfs-seeAlso">mysql_db_name()</a> - Get result data</li>
   </ul><p>
  </p>
 </div>

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites