mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
changed/corrected example
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@79305 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
382c740d5d
commit
66252c0eff
2 changed files with 43 additions and 17 deletions
|
@ -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>
|
||||
|
|
|
@ -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-error">
|
||||
<refnamediv>
|
||||
|
@ -29,20 +29,33 @@
|
|||
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 function.
|
||||
<informalexample>
|
||||
<example>
|
||||
<title>mysql_errno Example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
mysql_connect("marliesle");
|
||||
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_errno</function>
|
||||
|
|
Loading…
Reference in a new issue