reference/mysqli/mysqli/close.xml
f781803449007bb0e3a96c693e0eee067f7eb466
...
...
@@ -10,19 +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
-
&mysql.close.connections.result.sets;
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>
26
33
</refsect1>
27
34

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

44
-
<refsect1 role="examples">
45
-
&reftitle.examples;
51
+
<refsect1 role="changelog">
52
+
&reftitle.changelog;
46
53
<para>
47
-
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>
48
72
</para>
49
73
</refsect1>
50
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
+

51
118
<refsect1 role="notes">
52
119
&reftitle.notes;
53
120
<note>
...
...
@@ -72,7 +139,6 @@
72
139
</refsect1>
73
140

74
141
</refentry>
75
-

76
142
<!-- Keep this comment at the end of the file
77
143
Local variables:
78
144
mode: sgml
79
145