reference/pdo/pdostatement/columncount.xml
28529d3539b850e870e3aa97570f4db0e53daa03
...
...
@@ -9,42 +9,52 @@
9
9
</refnamediv>
10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
-
<methodsynopsis>
12
+
<methodsynopsis role="PDOStatement">
13
13
<modifier>public</modifier> <type>int</type><methodname>PDOStatement::columnCount</methodname>
14
14
<void/>
15
15
</methodsynopsis>
16
16

17
17
<para>
18
-
Use <function>PDOStatement::columnCount</function> to return the number
18
+
Use <methodname>PDOStatement::columnCount</methodname> to return the number
19
19
of columns in the result set represented by the PDOStatement object.
20
20
</para>
21
21
<para>
22
-
If the PDOStatement object was returned from <function>PDO::query</function>,
22
+
If the PDOStatement object was returned from <methodname>PDO::query</methodname>,
23
23
the column count is immediately available.
24
24
</para>
25
25
<para>
26
26
If the PDOStatement object was returned from
27
-
<function>PDO::prepare</function>, an accurate column count will not be
28
-
available until you invoke <function>PDOStatement::execute</function>.
27
+
<methodname>PDO::prepare</methodname>, an accurate column count will not be
28
+
available until you invoke <methodname>PDOStatement::execute</methodname>.
29
29
</para>
30
+
</refsect1>
30
31

32
+
<refsect1 role="parameters">
33
+
&reftitle.parameters;
34
+
&no.function.parameters;
31
35
</refsect1>
36
+

32
37
<refsect1 role="returnvalues">
33
38
&reftitle.returnvalues;
34
39
<para>
35
40
Returns the number of columns in the result set represented by the
36
41
PDOStatement object, even if the result set is empty. If there is no result set,
37
-
<function>PDOStatement::columnCount</function> returns <literal>0</literal>.
42
+
<methodname>PDOStatement::columnCount</methodname> returns <literal>0</literal>.
38
43
</para>
39
44
</refsect1>
40
45

46
+
<refsect1 role="errors">
47
+
&reftitle.errors;
48
+
&pdo.errors;
49
+
</refsect1>
50
+

41
51
<refsect1 role="examples">
42
52
&reftitle.examples;
43
53
<para>
44
54
<example>
45
55
<title>Counting columns</title>
46
56
<para>
47
-
This example demonstrates how <function>PDOStatement::columnCount</function>
57
+
This example demonstrates how <methodname>PDOStatement::columnCount</methodname>
48
58
operates with and without a result set.
49
59
</para>
50
60
<programlisting role="php">
...
...
@@ -56,13 +66,13 @@ $sth = $dbh->prepare("SELECT name, colour FROM fruit");
56
66

57
67
/* Count the number of columns in the (non-existent) result set */
58
68
$colcount = $sth->columnCount();
59
-
print("Before execute(), result set has $colcount columns (should be 0)\n");
69
+
print "Before execute(), result set has $colcount columns (should be 0)\n";
60
70

61
71
$sth->execute();
62
72

63
73
/* Count the number of columns in the result set */
64
74
$colcount = $sth->columnCount();
65
-
print("After execute(), result set has $colcount columns (should be 2)\n");
75
+
print "After execute(), result set has $colcount columns (should be 2)\n";
66
76

67
77
?>
68
78
]]>
...
...
@@ -83,15 +93,14 @@ After execute(), result set has 2 columns (should be 2)
83
93
&reftitle.seealso;
84
94
<para>
85
95
<simplelist>
86
-
<member><function>PDO::prepare</function></member>
87
-
<member><function>PDOStatement::execute</function></member>
88
-
<member><function>PDOStatement::rowCount</function></member>
96
+
<member><methodname>PDO::prepare</methodname></member>
97
+
<member><methodname>PDOStatement::execute</methodname></member>
98
+
<member><methodname>PDOStatement::rowCount</methodname></member>
89
99
</simplelist>
90
100
</para>
91
101
</refsect1>
92
102

93
103
</refentry>
94
-

95
104
<!-- Keep this comment at the end of the file
96
105
Local variables:
97
106
mode: sgml
98
107