cvs: phpdoc-zh /reference/mysql/functions mysql-data-seek.xml mysql-db-name.xml

From: Date: Thu, 09 Feb 2006 04:38:49 +0000
Subject: cvs: phpdoc-zh /reference/mysql/functions mysql-data-seek.xml mysql-db-name.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-2780@lists.php.net to get a copy of this message
dallas Thu Feb 9 04:38:49 2006 UTC Modified files: /phpdoc-zh/reference/mysql/functions mysql-data-seek.xml mysql-db-name.xml Log: Updated.

http://cvs.php.net/viewcvs.cgi/phpdoc-zh/reference/mysql/functions/mysql-data-seek.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc-zh/reference/mysql/functions/mysql-data-seek.xml diff -u phpdoc-zh/reference/mysql/functions/mysql-data-seek.xml:1.2 phpdoc-zh/reference/mysql/functions/mysql-data-seek.xml:1.3 --- phpdoc-zh/reference/mysql/functions/mysql-data-seek.xml:1.2 Mon Aug 18 23:57:06 2003 +++ phpdoc-zh/reference/mysql/functions/mysql-data-seek.xml Thu Feb 9 04:38:49 2006 @@ -1,79 +1,124 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> - <refentry id="function.mysql-data-seek"> - <refnamediv> - <refname>mysql_data_seek</refname> - <refpurpose>ÒÆ¶¯ÄÚ²¿½á¹ûµÄÖ¸Õë</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>bool</type><methodname>mysql_data_seek</methodname> - <methodparam><type>resource</type><parameter>result_identifier</parameter></methodparam> - <methodparam><type>int</type><parameter>row_number</parameter></methodparam> - </methodsynopsis> - <para> - &return.success; - </para> - <para> - <function>mysql_data_seek</function> ½«Ö¸¶¨µÄ½á¹û±êʶËù¹ØÁªµÄ - MySQL ½á¹ûÄÚ²¿µÄÐÐÖ¸ÕëÒÆ¶¯µ½Ö¸¶¨µÄÐкš£½Ó×ŵ÷Óà - <function>mysql_fetch_row</function> ½«·µ»ØÄÇÒ»ÐС£ - </para> - <para> - <parameter>row_number</parameter> ´Ó 0 ¿ªÊ¼¡£<parameter>row_number</parameter> - µÄȡֵ·¶Î§Ó¦¸Ã´Ó 0 µ½ mysql_num_rows - 1¡£ - </para> - <note> - <para> - <function>mysql_data_seek</function> Ö»ÄÜºÍ - <function>mysql_query</function> ½áºÏÆðÀ´Ê¹Ó㬶ø²»ÄÜÓÃÓÚ - <function>mysql_unbuffered_query</function>¡£ - </para> - </note> - <para> - <example> - <title>MySQL Êý¾Ý¼ìË÷Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.17 Maintainer: dallas Status: ready --> +<refentry id="function.mysql-data-seek"> + <refnamediv> + <refname>mysql_data_seek</refname> + <refpurpose>ÒÆ¶¯ÄÚ²¿½á¹ûµÄÖ¸Õë</refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>bool</type><methodname>mysql_data_seek</methodname> + <methodparam><type>resource</type><parameter>result</parameter></methodparam> + <methodparam><type>int</type><parameter>row_number</parameter></methodparam> + </methodsynopsis> + <para> + <function>mysql_data_seek</function> ½«Ö¸¶¨µÄ½á¹û±êʶËù¹ØÁªµÄ + MySQL ½á¹ûÄÚ²¿µÄÐÐÖ¸ÕëÒÆ¶¯µ½Ö¸¶¨µÄÐкš£½Ó×ŵ÷Óà + <function>mysql_fetch_row</function> ½«·µ»ØÄÇÒ»ÐС£ + </para> + <para> + <parameter>row_number</parameter> ´Ó 0 ¿ªÊ¼¡£<parameter>row_number</parameter> + µÄȡֵ·¶Î§Ó¦¸Ã´Ó 0 µ½ mysql_num_rows - 1¡£µ«ÊÇÈç¹û½á¹û¼¯Îª¿Õ£¨<function>mysql_num_rows</function> + == 0£©£¬Òª½«Ö¸ÕëÒÆ¶¯µ½ 0 »áʧ°Ü²¢·¢³ö <link linkend="e-warning">E_WARNING</link> + ¼¶µÄ´íÎó£¬<function>mysql_data_seek</function> ½«·µ»Ø &false;¡£ + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + &mysql.result.description; + <varlistentry> + <term><parameter>row_number</parameter></term> + <listitem> + <para> + ÏëÒªÉ趨µÄеĽá¹û¼¯Ö¸ÕëµÄÐÐÊý¡£ + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + &return.success; + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>mysql_data_seek</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php - $link = mysql_pconnect("localhost", "mysql_user", "mysql_password") - or die("Could not connect: " . mysql_error()); - - mysql_select_db("samp_db") - or die("Could not select database: " . mysql_error()); - - $query = "SELECT last_name, first_name FROM friends"; - $result = mysql_query($query) - or die("Query failed: " . mysql_error()); - - /* fetch rows in reverse order */ - for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) { - if (!mysql_data_seek($result, $i)) { - echo "Cannot seek to row $i: " . mysql_error() . "\n"; - continue; - } - - if(!($row = mysql_fetch_object($result))) - continue; +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('Could not connect: ' . mysql_error()); +} +$db_selected = mysql_select_db('sample_db'); +if (!$db_selected) { + die('Could not select database: ' . mysql_error()); +} +$query = 'SELECT last_name, first_name FROM friends'; +$result = mysql_query($query); +if (!$result) { + die('Query failed: ' . mysql_error()); +} +/* fetch rows in reverse order */ +for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) { + if (!mysql_data_seek($result, $i)) { + echo "Cannot seek to row $i: " . mysql_error() . "\n"; + continue; + } - echo "$row->last_name $row->first_name<br />\n"; + if (!($row = mysql_fetch_assoc($result))) { + continue; } - mysql_free_result($result); + echo $row['last_name'] . ' ' . $row['first_name'] . "<br />\n"; +} + +mysql_free_result($result); ?> ]]> - </programlisting> - </example> - </para> - <para> - ²Î¼û <function>mysql_query</function> ºÍ - <function>mysql_num_rows</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <note> + <para> + <function>mysql_data_seek</function> Ö»ÄÜºÍ + <function>mysql_query</function> ½áºÏÆðÀ´Ê¹Ó㬶ø²»ÄÜÓÃÓÚ + <function>mysql_unbuffered_query</function>¡£ + </para> + </note> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>mysql_query</function></member> + <member><function>mysql_num_rows</function></member> + <member><function>mysql_fetch_row</function></member> + <member><function>mysql_fetch_assoc</function></member> + <member><function>mysql_fetch_array</function></member> + <member><function>mysql_fetch_object</function></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewcvs.cgi/phpdoc-zh/reference/mysql/functions/mysql-db-name.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc-zh/reference/mysql/functions/mysql-db-name.xml diff -u phpdoc-zh/reference/mysql/functions/mysql-db-name.xml:1.2 phpdoc-zh/reference/mysql/functions/mysql-db-name.xml:1.3 --- phpdoc-zh/reference/mysql/functions/mysql-db-name.xml:1.2 Mon Aug 18 23:57:06 2003 +++ phpdoc-zh/reference/mysql/functions/mysql-db-name.xml Thu Feb 9 04:38:49 2006 @@ -1,58 +1,110 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.mysql-db-name"> - <refnamediv> - <refname>mysql_db_name</refname> - <refpurpose>È¡µÃ½á¹ûÊý¾Ý</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>mysql_db_name</methodname> - <methodparam><type>resource</type><parameter>result</parameter></methodparam> - <methodparam><type>int</type><parameter>row</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>field</parameter></methodparam> - </methodsynopsis> - <para> - <function>mysql_db_name</function> ½«µ÷Óà - <function>mysql_list_dbs</function> - ·µ»ØµÄ½á¹ûÖ¸Õë×÷ΪµÚÒ»¸ö²ÎÊý¡£<parameter>row</parameter> - ²ÎÊýÊǽá¹û¼¯ÖеÄÒ»¸öË÷Òý¡£ - </para> - <para> - Èç¹û³ö´íÔò·µ»Ø &false;¡£Óà - <function>mysql_errno</function> ºÍ - <function>mysql_error</function> À´È·¶¨´íÎóµÄÖÖÀà¡£ - </para> - <para> - <example> - <title><function>mysql_db_name</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.9 Maintainer: dallas Status: ready --> +<refentry id="function.mysql-db-name"> + <refnamediv> + <refname>mysql_db_name</refname> + <refpurpose>È¡µÃ½á¹ûÊý¾Ý</refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>string</type><methodname>mysql_db_name</methodname> + <methodparam><type>resource</type><parameter>result</parameter></methodparam> + <methodparam><type>int</type><parameter>row</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>field</parameter></methodparam> + </methodsynopsis> + <para> + È¡µÃ <function>mysql_list_dbs</function> µ÷ÓÃËù·µ»ØµÄÊý¾Ý¿âÃû¡£ + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>result</parameter></term> + <listitem> + <para> + <function>mysql_list_dbs</function> µ÷ÓÃËù·µ»ØµÄ½á¹ûÖ¸Õë¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>row</parameter></term> + <listitem> + <para> + ½á¹û¼¯ÖеÄÐкš£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>field</parameter></term> + <listitem> + <para> + ×Ö¶ÎÃû¡£ + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + Èç¹û³É¹¦Ôò·µ»ØÊý¾Ý¿âÃû£¬Ê§°Ü·µ»Ø &false;¡£Èç¹û·µ»ØÁË &false;£¬Óà + <function>mysql_error</function> À´ÅжϴíÎóµÄÖÖÀà¡£ + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>mysql_db_name</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php - error_reporting(E_ALL); +error_reporting(E_ALL); - mysql_connect('dbhost', 'username', 'password'); - $db_list = mysql_list_dbs(); +$link = mysql_connect('dbhost', 'username', 'password'); +$db_list = mysql_list_dbs($link); - $i = 0; - $cnt = mysql_num_rows($db_list); - while ($i < $cnt) { - echo mysql_db_name($db_list, $i) . "\n"; - $i++; - } +$i = 0; +$cnt = mysql_num_rows($db_list); +while ($i < $cnt) { + echo mysql_db_name($db_list, $i) . "\n"; + $i++; +} ?> ]]> - </programlisting> - </example> - </para> - <para> - ΪÏòϼæÈÝÒ²¿ÉÒÔÓà <function>mysql_dbname</function>¡£µ«²¢²»Ìᳫ¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <note> + <para> + &info.deprecated.alias;<function>mysql_dbname</function>¡£ + </para> + </note> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>mysql_list_dbs</function></member> + <member><function>mysql_tablename</function></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables:
« previous php.doc.zh (#2780) next »