php-doc-en/reference/mysqli/mysqli_stmt/param-count.xml
2012-01-10 10:37:32 +00:00

136 lines
3.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqli-stmt.param-count" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mysqli_stmt::$param_count</refname>
<refname>mysqli_stmt_param_count</refname>
<refpurpose>Returns the number of parameter for the given statement</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>&style.oop;</para>
<fieldsynopsis><type>int</type><varname linkend="mysqli-stmt.param-count">mysqli_stmt->param_count</varname></fieldsynopsis>
<para>&style.procedural;</para>
<methodsynopsis>
<type>int</type><methodname>mysqli_stmt_param_count</methodname>
<methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Returns the number of parameter markers present 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 parameters.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>&style.oop;</title>
<programlisting role="php">
<![CDATA[
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = $mysqli->prepare("SELECT Name FROM Country WHERE Name=? OR Code=?")) {
$marker = $stmt->param_count;
printf("Statement has %d markers.\n", $marker);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
]]>
</programlisting>
</example>
<example>
<title>&style.procedural;</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = mysqli_prepare($link, "SELECT Name FROM Country WHERE Name=? OR Code=?")) {
$marker = mysqli_stmt_param_count($stmt);
printf("Statement has %d markers.\n", $marker);
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
]]>
</programlisting>
&examples.outputs;
<screen>
<![CDATA[
Statement has 2 markers.
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mysqli_prepare</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->