reference/mysqli/mysqli/connect-errno.xml
104bc5c203adbc75f7c71960bb18b2b71c889b45
...
...
@@ -17,25 +17,20 @@
17
17
<void />
18
18
</methodsynopsis>
19
19
<para>
20
-
Returns the last error code number from the last call to
21
-
<function>mysqli_connect</function>.
20
+
Returns the error code from the last connection attempt.
22
21
</para>
23
-
<note>
24
-
<para>
25
-
Client error message numbers are listed in the MySQL
26
-
<filename>errmsg.h</filename> header file, server error message numbers
27
-
are listed in <filename>mysqld_error.h</filename>. In the MySQL source
28
-
distribution you can find a complete list of error messages and error
29
-
numbers in the file <filename>Docs/mysqld_error.txt</filename>.
30
-
</para>
31
-
</note>
22
+
</refsect1>
23
+

24
+
<refsect1 role="parameters">
25
+
&reftitle.parameters;
26
+
&no.function.parameters;
32
27
</refsect1>
33
28

34
29
<refsect1 role="returnvalues">
35
30
&reftitle.returnvalues;
36
31
<para>
37
-
An error code value for the last call to <function>mysqli_connect</function>, if it failed.
38
-
zero means no error occurred.
32
+
An error code for the last connection attempt, if it failed.
33
+
Zero means no error occurred.
39
34
</para>
40
35
</refsect1>
41
36

...
...
@@ -47,32 +42,30 @@
47
42
<programlisting role="php">
48
43
<![CDATA[
49
44
<?php
50
-
$mysqli = @new mysqli('localhost', 'fake_user', 'my_password', 'my_db');
51
45

46
+
mysqli_report(MYSQLI_REPORT_OFF);
47
+
/* @ is used to suppress warnings */
48
+
$mysqli = @new mysqli('localhost', 'fake_user', 'wrong_password', 'does_not_exist');
52
49
if ($mysqli->connect_errno) {
53
-
die('Connect Error: ' . $mysqli->connect_errno);
50
+
/* Use your preferred error logging method here */
51
+
error_log('Connection error: ' . $mysqli->connect_errno);
54
52
}
55
-
?>
56
53
]]>
57
54
</programlisting>
58
55
<para>&style.procedural;</para>
59
56
<programlisting role="php">
60
57
<![CDATA[
61
58
<?php
62
-
$link = @mysqli_connect('localhost', 'fake_user', 'my_password', 'my_db');
63
59

60
+
mysqli_report(MYSQLI_REPORT_OFF);
61
+
/* @ is used to suppress warnings */
62
+
$link = @mysqli_connect('localhost', 'fake_user', 'wrong_password', 'does_not_exist');
64
63
if (!$link) {
65
-
die('Connect Error: ' . mysqli_connect_errno());
64
+
/* Use your preferred error logging method here */
65
+
error_log('Connection error: ' . mysqli_connect_errno());
66
66
}
67
-
?>
68
67
]]>
69
68
</programlisting>
70
-
&examples.outputs;
71
-
<screen>
72
-
<![CDATA[
73
-
Connect Error: 1045
74
-
]]>
75
-
</screen>
76
69
</example>
77
70
</refsect1>
78
71

79
72