cvs: phpdoc /en/functions mysql.xml

From: Date: Sat, 19 May 2001 22:03:50 +0000
Subject: cvs: phpdoc /en/functions mysql.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969335437@lists.php.net to get a copy of this message
jeroen Sat May 19 15:03:50 2001 EDT Modified files: /phpdoc/en/functions mysql.xml Log: Added mysql_fetch_assoc (wondering why it wasn't documented ;-) Index: phpdoc/en/functions/mysql.xml diff -u phpdoc/en/functions/mysql.xml:1.44 phpdoc/en/functions/mysql.xml:1.45 --- phpdoc/en/functions/mysql.xml:1.44 Sat May 19 13:39:38 2001 +++ phpdoc/en/functions/mysql.xml Sat May 19 15:03:50 2001 @@ -724,7 +724,66 @@ </refsect1> </refentry> - <refentry id="function.mysql-fetch-field"> + <refentry id="function.mysql-fetch-assoc"> + <refnamediv> + <refname>mysql_fetch_assoc</refname> + <refpurpose> + Fetch a result row as an associative array + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>mysql_fetch_assoc</function></funcdef> + <paramdef>resource <parameter>result</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Returns an associative array that corresponds to the fetched row, + or false if there are no more rows.</para> + <para> + <function>mysql_fetch_assoc</function> is equivalent to calling + <function>mysql_fetch_array</function> with MYSQL_ASSOC for the + optional second parameter. It only returns an associative array. + This is the way <function>mysql_fetch_array</function> originally + worked. If you need the numeric indices as well as the + associative, use <function>mysql_fetch_array</function>. + </para> + <para> + If two or more columns of the result have the same field names, + the last column will take precedence. To access the other column(s) + of the same name, you must use <function>mysql_fetch_array</function> and + have it return the numeric indices as well. + </para> + <para> + An important thing to note is that using + <function>mysql_fetch_assoc</function> is NOT significantly + slower than using <function>mysql_fetch_row</function>, while it + provides a significant added value. + </para> + <para> + For further details, see also + <function>mysql_fetch_row</function> and <function>mysql_fetch_array</function>. + </para> + <example> + <title><function>Mysql_fetch_assoc</function></title> + <programlisting role="php"> +&lt;?php +mysql_connect ($host, $user, $password); +$result = mysql_db_query ("database","select * from table"); +while ($row = mysql_fetch_assoc ($result)) { + echo $row["user_id"]; + echo $row["fullname"]; +} +mysql_free_result ($result); +?> + </programlisting> + </example> + </refsect1> + </refentry> + + <refentry id="function.mysql-fetch-field"> <refnamediv> <refname>mysql_fetch_field</refname> <refpurpose>

« previous php.doc (#969335437) next »