cvs: phpdoc /nl/reference/mysql/functions mysql-affected-rows.xml

From: Date: Mon, 29 Apr 2002 09:24:21 +0000
Subject: cvs: phpdoc /nl/reference/mysql/functions mysql-affected-rows.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969345004@lists.php.net to get a copy of this message
manuzhai Mon Apr 29 05:24:21 2002 EDT Modified files: /phpdoc/nl/reference/mysql/functions mysql-affected-rows.xml Log: Updated to EN 1.4 Index: phpdoc/nl/reference/mysql/functions/mysql-affected-rows.xml diff -u phpdoc/nl/reference/mysql/functions/mysql-affected-rows.xml:1.2 phpdoc/nl/reference/mysql/functions/mysql-affected-rows.xml:1.3 --- phpdoc/nl/reference/mysql/functions/mysql-affected-rows.xml:1.2 Wed Apr 17 03:14:09 2002 +++ phpdoc/nl/reference/mysql/functions/mysql-affected-rows.xml Mon Apr 29 05:24:21 2002 @@ -1,8 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/mysql.xml, last change in rev 1.1 --> -<!-- last change to 'mysql-affected-rows' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: manuzhai Status: ready --> -<!-- OLD-Revision: 1.95/EN.1.2 --> +<!-- EN-Revision: 1.4 Maintainer: manuzhai Status: ready --> <refentry id="function.mysql-affected-rows"> <refnamediv> <refname>mysql_affected_rows</refname> @@ -53,9 +50,65 @@ </para> <para> Als de laatste query faalde, geeft deze functie -1 terug. - </para> + <example> + <title>Delete-Query</title> + <programlisting role="php"> + <![CDATA[ + <?php + /* Verbinding maken met de database */ + mysql_pconnect("localhost", "mysql_user", "mysql_password") or + die ("Kan geen verbinding maken"); + + /* Dit zou het correcte aantal gedelete records terug moeten geven */ + mysql_query("DELETE FROM mytable WHERE id < 10"); + printf ("Records deleted: %d\n", mysql_affected_rows()); + + /* Zonder een WHERE clause in de query geeft dit 0 terug */ + mysql_query("DELETE FROM mytable"); + printf ("Records deleted: %d\n", mysql_affected_rows()); + ?> + ]]> + </programlisting> + <para> + Het bovenstaande voorbeeld zou de volgende output produceren: + <screen> + <![CDATA[ + Records deleted: 10 + Records deleted: 0 + ]]> + </screen> + </para> + </example> + <example> + <title>Update-Query</title> + <programlisting role="php"> + <![CDATA[ + <?php + /* Verbinding maken met de database */ + mysql_pconnect("localhost", "mysql_user", "mysql_password") or + die ("Kan geen verbinding maken"); + + /* Update records */ + mysql_query("UPDATE mytable SET used=1 WHERE id < 10"); + printf ("Updated records: %d\n", mysql_affected_rpws()); + mysql_query("COMMIT"); + ?> + ]]> + </programlisting> + <para> + Het bovenstaande voorbeeld zou de volgende output produceren: + <screen> + <![CDATA[ + Updated Records: 10 + ]]> + </screen> + </para> + </example> + </para> <para> - Zie ook: <function>mysql_num_rows</function>. + <para> + See also: <function>mysql_num_rows</function>, + <function>mysql_info</function>. </para> </refsect1> </refentry>

« previous php.doc (#969345004) next »