georg Sun Apr 21 09:42:53 2002 EDT
Modified files:
/phpdoc/en/reference/mysql/functions mysql-errno.xml
Log:
changed/corrected example
Index: phpdoc/en/reference/mysql/functions/mysql-errno.xml
diff -u phpdoc/en/reference/mysql/functions/mysql-errno.xml:1.2
phpdoc/en/reference/mysql/functions/mysql-errno.xml:1.3
--- phpdoc/en/reference/mysql/functions/mysql-errno.xml:1.2 Wed Apr 17 02:41:06
2002
+++ phpdoc/en/reference/mysql/functions/mysql-errno.xml Sun Apr 21 09:42:53 2002
@@ -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.2 -->
<refentry id="function.mysql-errno">
<refnamediv>
@@ -28,22 +28,35 @@
error code from the most recently executed MySQL function (not
including <function>mysql_error</function> and
<function>mysql_errno</function>), so if you want to use it,
- make sure you check the value before calling another mySQL
+ make sure you check the value before calling another MySQL
function.
- <informalexample>
+ <example>
+ <title>mysql_errno Example</title>
<programlisting role="php">
<![CDATA[
<?php
- mysql_connect("kossu");
- echo mysql_errno().": ".mysql_error()."<br />";
+ mysql_connect("localhost", "mysql_user", "mysql_password");
+
mysql_select_db("nonexistentdb");
- echo mysql_errno().": ".mysql_error()."<br />";
- $conn = mysql_query("SELECT * FROM nonexistenttable");
- echo mysql_errno().": ".mysql_error()."<br />";
+ echo mysql_errno() . ": " . mysql_error(). "\n";
+
+ mysql_select_db("kossu");
+ mysql_query("SELECT * FROM nonexistenttable");
+ echo mysql_errno() . ": " . mysql_error() . "\n";
?>
]]>
</programlisting>
- </informalexample>
+ <para>
+ The above example would produce the following output:
+ </para>
+ <screen>
+<![CDATA[
+1049: Unknown database 'nonexistentdb'
+1146: Table 'kossu.nonexistenttable' doesn't exist
+Records deleted: 0
+]]>
+ </screen>
+ </example>
</para>
<para>
See also: <function>mysql_error</function>