Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 80 additions & 2 deletions reference/mysqli/mysqli_stmt/field-count.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<refnamediv>
<refname>mysqli_stmt::$field_count</refname>
<refname>mysqli_stmt_field_count</refname>
<refpurpose>Returns the number of field in the given statement</refpurpose>
<refpurpose>Returns the number of columns in the given statement</refpurpose>
</refnamediv>

<refsect1 role="description">
Expand All @@ -16,9 +16,87 @@
<type>int</type><methodname>mysqli_stmt_field_count</methodname>
<methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Returns the number of columns in the prepared statement.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&mysqli.stmt.description;
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an integer representing the number of columns.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns an integer representing the number of columns.
Returns an <type>int</type> representing the number of columns.

Maybe?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave it consistent then, might make sense to update this in the future to use a proper type element for all pages.

</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
<title>&style.oop;</title>
<programlisting role="php">
<![CDATA[
<?php

&warn.undocumented.func;
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

$code = 'FR';

$stmt = $mysqli->prepare("SELECT Name FROM Country WHERE Code=?");
$stmt->bind_param('s', $code);
$stmt->execute();
$row = $stmt->get_result()->fetch_row();
for ($i = 0; $i < $stmt->field_count; $i++) {
printf("Value of column number %d is %s", $i, $row[$i]);
}
]]>
</programlisting>
</example>
<example>
<title>&style.procedural;</title>
<programlisting role="php">
<![CDATA[
<?php

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

$code = 'FR';

$stmt = mysqli_prepare($mysqli, "SELECT Name FROM Country WHERE Code=?");
mysqli_stmt_bind_param($stmt, 's', $code);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_row($result);
for ($i = 0; $i < mysqli_stmt_field_count($stmt); $i++) {
printf("Value of column number %d is %s", $i, $row[$i]);
}
]]>
</programlisting>
&examples.outputs.similar;
<screen>
<![CDATA[
Value of column number 0 is France
]]>
</screen>
</example>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mysqli_stmt_num_rows</function></member>
</simplelist>
</para>
</refsect1>

</refentry>
Expand Down
2 changes: 1 addition & 1 deletion reference/mysqli/mysqli_stmt/param-count.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<refnamediv>
<refname>mysqli_stmt::$param_count</refname>
<refname>mysqli_stmt_param_count</refname>
<refpurpose>Returns the number of parameter for the given statement</refpurpose>
<refpurpose>Returns the number of parameters for the given statement</refpurpose>
</refnamediv>

<refsect1 role="description">
Expand Down