reference/mysqli/mysqli/close.xml
f781803449007bb0e3a96c693e0eee067f7eb466
...
...
@@ -10,18 +10,26 @@
10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
12
<para>&style.oop;</para>
13
-
<methodsynopsis role="oop">
14
-
<type>bool</type><methodname>mysqli::close</methodname>
15
-
<void />
13
+
<methodsynopsis role="mysqli">
14
+
<modifier>public</modifier> <type>true</type><methodname>mysqli::close</methodname>
15
+
<void/>
16
16
</methodsynopsis>
17
17
<para>&style.procedural;</para>
18
18
<methodsynopsis>
19
-
<type>bool</type><methodname>mysqli_close</methodname>
20
-
<methodparam><type>mysqli</type><parameter>link</parameter></methodparam>
19
+
<type>true</type><methodname>mysqli_close</methodname>
20
+
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
21
21
</methodsynopsis>
22
22
<para>
23
23
Closes a previously opened database connection.
24
24
</para>
25
+
<para>
26
+
Open non-persistent MySQL connections and result sets are automatically
27
+
closed when their objects are destroyed. Explicitly closing open
28
+
connections and freeing result sets is optional. However, it's a good idea
29
+
to close the connection as soon as the script finishes performing all of its
30
+
database operations, if it still has a lot of processing to do after
31
+
getting the results.
32
+
</para>
25
33
</refsect1>
26
34

27
35
<refsect1 role="parameters">
...
...
@@ -36,17 +44,88 @@
36
44
<refsect1 role="returnvalues">
37
45
&reftitle.returnvalues;
38
46
<para>
39
-
&return.success;
47
+
&return.true.always;
40
48
</para>
41
49
</refsect1>
42
50

43
-
<refsect1 role="examples">
44
-
&reftitle.examples;
51
+
<refsect1 role="changelog">
52
+
&reftitle.changelog;
45
53
<para>
46
-
See <function>mysqli_connect</function>.
54
+
<informaltable>
55
+
<tgroup cols="2">
56
+
<thead>
57
+
<row>
58
+
<entry>&Version;</entry>
59
+
<entry>&Description;</entry>
60
+
</row>
61
+
</thead>
62
+
<tbody>
63
+
<row>
64
+
<entry>8.0.0</entry>
65
+
<entry>
66
+
This function now always returns &true;. Previously it returned &false; on failure.
67
+
</entry>
68
+
</row>
69
+
</tbody>
70
+
</tgroup>
71
+
</informaltable>
47
72
</para>
48
73
</refsect1>
49
74

75
+
<refsect1 role="examples">
76
+
&reftitle.examples;
77
+
<example>
78
+
<title><methodname>mysqli::close</methodname> example</title>
79
+
<para>&style.oop;</para>
80
+
<programlisting role="php">
81
+
<![CDATA[
82
+
<?php
83
+

84
+
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
85
+
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
86
+

87
+
$result = $mysqli->query("SELECT Name, CountryCode FROM City ORDER BY ID LIMIT 3");
88
+

89
+
/* Close the connection as soon as it's no longer needed */
90
+
$mysqli->close();
91
+

92
+
foreach ($result as $row) {
93
+
/* Processing of the data retrieved from the database */
94
+
}
95
+
]]>
96
+
</programlisting>
97
+
<para>&style.procedural;</para>
98
+
<programlisting role="php">
99
+
<![CDATA[
100
+
<?php
101
+

102
+
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
103
+
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");
104
+

105
+
$result = mysqli_query($mysqli, "SELECT Name, CountryCode FROM City ORDER BY ID LIMIT 3");
106
+

107
+
/* Close the connection as soon as it's no longer needed */
108
+
mysqli_close($mysqli);
109
+

110
+
foreach ($result as $row) {
111
+
/* Processing of the data retrieved from the database */
112
+
}
113
+
]]>
114
+
</programlisting>
115
+
</example>
116
+
</refsect1>
117
+

118
+
<refsect1 role="notes">
119
+
&reftitle.notes;
120
+
<note>
121
+
<para>
122
+
<function>mysqli_close</function> will not close persistent connections.
123
+
For additional details, see the manual page on
124
+
<link linkend="features.persistent-connections">persistent connections</link>.
125
+
</para>
126
+
</note>
127
+
</refsect1>
128
+

50
129
<refsect1 role="seealso">
51
130
&reftitle.seealso;
52
131
<para>
...
...
@@ -54,12 +133,12 @@
54
133
<member><methodname>mysqli::__construct</methodname></member>
55
134
<member><function>mysqli_init</function></member>
56
135
<member><function>mysqli_real_connect</function></member>
136
+
<member><function>mysqli_free_result</function></member>
57
137
</simplelist>
58
138
</para>
59
139
</refsect1>
60
140

61
141
</refentry>
62
-

63
142
<!-- Keep this comment at the end of the file
64
143
Local variables:
65
144
mode: sgml
66
145