★ wanayoo — archive 1999 http://fr.php.net/manual/es/function.mysql-field-table.phpNouvelle recherche | Portail wanayoo
PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<mysql_field_seekmysql_field_type>
view the version of this page
Last updated: Tue, 29 Mar 2005

mysql_field_table

(PHP 3, PHP 4 , PHP 5)

mysql_field_table --  Devuelve el nombre de la tabla donde está el campo específicado

Descripción

cadena mysql_field_table ( int id_resultado, int offset_del_campo )

Devuelve el nombre de la tabla donde está el campo.

Ejemplo 1. Ejemplo mysql_field_table

<?php
$result
= mysql_query("SELECT name,comment FROM people,comments");
if (!
$result) {
   echo
'Could not run query: ' . mysql_error();
   exit;
}

// Assuming name is in the people table
$table = mysql_field_table($result, 'name');
echo
$table; // people
?>

Por razones de compatibilidad puede usarse también mysql_fieldtable(). Sin embargo esta función es obsoleta.

Vea también mysql_list_tables().



add a note add a note User Contributed Notes
mysql_field_table
doelling_at_publicform_dot_de
12-Nov-2004 04:08
Similarly to the behaviour described by cptnemo this function returns only the name of the first table when you use a JOIN.
For example with the query below the table name would be table1 for all fields:

SELECT table1.*, table2.this_thing, table3.that_thing FROM table1 LEFT JOIN table2 ON table1.tb2_id = table2.id LEFT JOIN table3 ON table1.tb3_id = table3.id

The expected behaviour would be, that the table name for the field this_thing is table2 and table3 for the field that_thing respectively.
cptnemo
15-Aug-2004 04:18
When trying to find table names for a (My)SQL query containing 'tablename AS alias', mysql_field_table() only returns the alias as specified in the AS clause, and not the tablename.

<mysql_field_seekmysql_field_type>
 Last updated: Tue, 29 Mar 2005
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This mirror generously provided by: nexen.net
Last updated: Fri Apr 8 05:28:00 2005 CEST