philip Wed Jul 14 17:08:10 2004 EDT
Modified files:
/phpdoc/en/reference/mysql/functions mysql-field-flags.xml
mysql-fetch-row.xml
mysql-field-len.xml
mysql-fetch-lengths.xml
mysql-field-table.xml
Log:
Added an example, and see also.
http://cvs.php.net/diff.php/phpdoc/en/reference/mysql/functions/mysql-field-flags.xml?r1=1.2&r2=1.3&ty=u
Index: phpdoc/en/reference/mysql/functions/mysql-field-flags.xml
diff -u phpdoc/en/reference/mysql/functions/mysql-field-flags.xml:1.2
phpdoc/en/reference/mysql/functions/mysql-field-flags.xml:1.3
--- phpdoc/en/reference/mysql/functions/mysql-field-flags.xml:1.2 Wed Apr 17
02:41:11 2002
+++ phpdoc/en/reference/mysql/functions/mysql-field-flags.xml Wed Jul 14 17:08:10
2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.17 -->
<refentry id="function.mysql-field-flags">
<refnamediv>
@@ -25,6 +25,38 @@
is current enough to support them: "not_null", "primary_key",
"unique_key", "multiple_key", "blob", "unsigned", "zerofill",
"binary", "enum", "auto_increment", "timestamp".
+ </para>
+ <para>
+ <example>
+ <title>A <function>mysql_field_flags</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
+if (!$result) {
+ echo 'Could not run query: ' . mysql_error();
+ exit;
+}
+$flags = mysql_field_flags($result, 'id');
+
+print $flags;
+print_r(explode(' ', $flags));
+
+/* Output will look similar to:
+
+not_null primary_key auto_increment
+Array
+(
+ [0] => not_null
+ [1] => primary_key
+ [2] => auto_increment
+)
+
+*/
+?>
+]]>
+ </programlisting>
+ </example>
</para>
<para>
For downward compatibility <function>mysql_fieldflags</function>
http://cvs.php.net/diff.php/phpdoc/en/reference/mysql/functions/mysql-fetch-row.xml?r1=1.6&r2=1.7&ty=u
Index: phpdoc/en/reference/mysql/functions/mysql-fetch-row.xml
diff -u phpdoc/en/reference/mysql/functions/mysql-fetch-row.xml:1.6
phpdoc/en/reference/mysql/functions/mysql-fetch-row.xml:1.7
--- phpdoc/en/reference/mysql/functions/mysql-fetch-row.xml:1.6 Thu Feb 5 09:59:44
2004
+++ phpdoc/en/reference/mysql/functions/mysql-fetch-row.xml Wed Jul 14 17:08:10
2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-fetch-row">
<refnamediv>
@@ -26,6 +26,26 @@
Subsequent call to <function>mysql_fetch_row</function> would
return the next row in the result set, or &false; if there are no
more rows.
+ </para>
+ <para>
+ <example>
+ <title>Fetching one row with <function>mysql_fetch_row</function></title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
+if (!$result) {
+ echo 'Could not run query: ' . mysql_error();
+ exit;
+}
+$row = mysql_fetch_row($result);
+
+echo $row[0]; // 42
+echo $row[1]; // the email value
+?>
+]]>
+ </programlisting>
+ </example>
</para>
<para>
See also
http://cvs.php.net/diff.php/phpdoc/en/reference/mysql/functions/mysql-field-len.xml?r1=1.2&r2=1.3&ty=u
Index: phpdoc/en/reference/mysql/functions/mysql-field-len.xml
diff -u phpdoc/en/reference/mysql/functions/mysql-field-len.xml:1.2
phpdoc/en/reference/mysql/functions/mysql-field-len.xml:1.3
--- phpdoc/en/reference/mysql/functions/mysql-field-len.xml:1.2 Wed Apr 17 02:41:11
2002
+++ phpdoc/en/reference/mysql/functions/mysql-field-len.xml Wed Jul 14 17:08:10
2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.17 -->
<refentry id="function.mysql-field-len">
<refnamediv>
@@ -20,8 +20,33 @@
specified field.
</para>
<para>
+ <example>
+ <title>A <function>mysql_fetch_len</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
+if (!$result) {
+ echo 'Could not run query: ' . mysql_error();
+ exit;
+}
+
+// Will get the length of the value in email so for example
+// [EMAIL PROTECTED] would give us a length of 16
+$length = mysql_fetch_len($result, 'email');
+echo $length;
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
For downward compatibility <function>mysql_fieldlen</function>
can also be used. This is deprecated, however.
+ </para>
+ <para>
+ See also <function>mysql_fetch_lengths</function> and
+ <function>strlen</function>.
</para>
</refsect1>
</refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/mysql/functions/mysql-fetch-lengths.xml?r1=1.3&r2=1.4&ty=u
Index: phpdoc/en/reference/mysql/functions/mysql-fetch-lengths.xml
diff -u phpdoc/en/reference/mysql/functions/mysql-fetch-lengths.xml:1.3
phpdoc/en/reference/mysql/functions/mysql-fetch-lengths.xml:1.4
--- phpdoc/en/reference/mysql/functions/mysql-fetch-lengths.xml:1.3 Wed Jul 9
11:07:29 2003
+++ phpdoc/en/reference/mysql/functions/mysql-fetch-lengths.xml Wed Jul 14 17:08:10
2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.3 $ -->
+<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-fetch-lengths">
<refnamediv>
@@ -23,12 +23,50 @@
<function>mysql_fetch_lengths</function> stores the lengths of
each result column in the last row returned by
<function>mysql_fetch_row</function>,
+ <function>mysql_fetch_assoc</function>,
<function>mysql_fetch_array</function>, and
<function>mysql_fetch_object</function> in an array, starting at
offset 0.
</para>
<para>
- See also <function>mysql_fetch_row</function>.
+ <example>
+ <title>A <function>mysql_fetch_lengths</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
+if (!$result) {
+ echo 'Could not run query: ' . mysql_error();
+ exit;
+}
+$row = mysql_fetch_assoc($result);
+$lengths = mysql_fetch_lengths($result);
+
+print_r($row);
+print_r($lengths);
+
+/* Output will look similar to:
+Array
+(
+ [id] => 42
+ [email] => [EMAIL PROTECTED]
+)
+Array
+(
+ [0] => 2
+ [1] => 16
+)
+
+*/
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ See also <function>mysql_fetch_len</function>,
+ <function>mysql_fetch_row</function>, and
+ <function>strlen</function>.
</para>
</refsect1>
</refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/mysql/functions/mysql-field-table.xml?r1=1.3&r2=1.4&ty=u
Index: phpdoc/en/reference/mysql/functions/mysql-field-table.xml
diff -u phpdoc/en/reference/mysql/functions/mysql-field-table.xml:1.3
phpdoc/en/reference/mysql/functions/mysql-field-table.xml:1.4
--- phpdoc/en/reference/mysql/functions/mysql-field-table.xml:1.3 Thu Dec 18
09:14:30 2003
+++ phpdoc/en/reference/mysql/functions/mysql-field-table.xml Wed Jul 14 17:08:10
2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.3 $ -->
+<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-field-table">
<refnamediv>
@@ -20,8 +20,31 @@
in.
</para>
<para>
+ <example>
+ <title>A <function>mysql_field_table</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?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
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
For downward compatibility <function>mysql_fieldtable</function>
can also be used. This is deprecated, however.
+ </para>
+ <para>
+ See also <function>mysql_list_tables</function>.
</para>
</refsect1>
</refentry>