cvs: phpdoc /en/reference/mysql/functions mysql-field-table.xml
| From: | Nuno Lopes | Date: | Fri, 19 Oct 2007 12:06:00 +0000 |
| Subject: | cvs: phpdoc /en/reference/mysql/functions mysql-field-table.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-240@lists.php.net to get a copy of this message | ||
nlopess Fri Oct 19 12:06:00 2007 UTC
Modified files:
/phpdoc/en/reference/mysql/functions mysql-field-table.xml
Log:
fix the example, per user note
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysql/functions/mysql-field-table.xml?r1=1.8&r2=1.9&diff_format=u
Index: phpdoc/en/reference/mysql/functions/mysql-field-table.xml
diff -u phpdoc/en/reference/mysql/functions/mysql-field-table.xml:1.8
phpdoc/en/reference/mysql/functions/mysql-field-table.xml:1.9
--- phpdoc/en/reference/mysql/functions/mysql-field-table.xml:1.8 Wed Jun 20 22:25:00 2007
+++ phpdoc/en/reference/mysql/functions/mysql-field-table.xml Fri Oct 19 12:05:59 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
<refentry xml:id="function.mysql-field-table" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mysql_field_table</refname>
@@ -43,15 +43,20 @@
<programlisting role="php">
<![CDATA[
<?php
-$result = mysql_query("SELECT name,comment FROM people,comments");
-if (!$result) {
- echo 'Could not run query: ' . mysql_error();
- exit;
+
+$query = "SELECT account.*, country.* FROM account, country WHERE country.name =
'Portugal' AND account.country_id = country.id";
+
+// get the result from the DB
+$result = mysql_query($query);
+
+// Lists the table name and then the field name
+for ($i = 0; $i < mysql_num_fields($result); ++$i) {
+ $table = mysql_field_table($result, $i);
+ $field = mysql_field_name($result, $i);
+
+ echo "$table: $field\n";
}
-// Assuming name is in the people table
-$table = mysql_field_table($result, 'name');
-echo $table; // people
?>
]]>
</programlisting>