cvs: phpdoc /en/reference/mysqli mysqli_stmt.xml /en/reference/mysqli/functions mysqli-stmt-affected-rows.xml mysqli-stmt-attr-get.xml
mysqli-stmt-attr-set.xml mysqli-stmt-bind-param.xml mysqli-stmt-bind-result.xml mysqli-stmt-close.xml mysqli-stmt-data-seek.xml mysqli-stmt-errno.xml
mysqli-stmt-error.xml mysqli-stmt-execute.xml mysqli-stmt-fetch.xml mysqli-stmt-field-count.xml mysqli-stmt-free-result.xml
mysqli-stmt-get-warnings.xml mysqli-stmt-insert-id.xml mysqli-stmt-num-rows.xml mysqli-stmt-param-count.xml mysqli-stmt-prepare.xml
mysqli-stmt-reset.xml mysqli-stmt-result-metadata.xml mysqli-stmt-send-long-data.xml mysqli-stmt-sqlstate.xml mysqli-stmt-store-result.xml
/en/reference/mysqli/mysqli_stmt affected-rows.xml attr-get.xml attr-set.xml bind-param.xml bind-result.xml close.xml data-seek.xml errno.xml
error.xml execute.xml fetch.xml field-count.xml free-result.xml get-warnings.xml insert-id.xml num-rows.xml param-count.xml prepare.xml reset.xml
result-met! adata.xml send-long-data.xml sqlstate.xml store-result.xml

From: Date: Wed, 02 Jan 2008 14:08:21 +0000
Subject: cvs: phpdoc /en/reference/mysqli mysqli_stmt.xml /en/reference/mysqli/functions mysqli-stmt-affected-rows.xml mysqli-stmt-attr-get.xml
mysqli-stmt-attr-set.xml mysqli-stmt-bind-param.xml mysqli-stmt-bind-result.xml mysqli-stmt-close.xml mysqli-stmt-data-seek.xml mysqli-stmt-errno.xml
mysqli-stmt-error.xml mysqli-stmt-execute.xml mysqli-stmt-fetch.xml mysqli-stmt-field-count.xml mysqli-stmt-free-result.xml
mysqli-stmt-get-warnings.xml mysqli-stmt-insert-id.xml mysqli-stmt-num-rows.xml mysqli-stmt-param-count.xml mysqli-stmt-prepare.xml
mysqli-stmt-reset.xml mysqli-stmt-result-metadata.xml mysqli-stmt-send-long-data.xml mysqli-stmt-sqlstate.xml mysqli-stmt-store-result.xml
/en/reference/mysqli/mysqli_stmt affected-rows.xml attr-get.xml attr-set.xml bind-param.xml bind-result.xml close.xml data-seek.xml errno.xml
error.xml execute.xml fetch.xml field-count.xml free-result.xml get-warnings.xml insert-id.xml num-rows.xml param-count.xml prepare.xml reset.xml
result-met! adata.xml send-long-data.xml sqlstate.xml store-result.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-981@lists.php.net to get a copy of this message
bjori Wed Jan 2 14:08:21 2008 UTC Added files: /phpdoc/en/reference/mysqli/mysqli_stmt affected-rows.xml attr-get.xml attr-set.xml bind-param.xml bind-result.xml close.xml data-seek.xml errno.xml error.xml execute.xml fetch.xml field-count.xml free-result.xml get-warnings.xml insert-id.xml num-rows.xml param-count.xml prepare.xml reset.xml result-metadata.xml send-long-data.xml sqlstate.xml store-result.xml Removed files: /phpdoc/en/reference/mysqli/functions mysqli-stmt-affected-rows.xml mysqli-stmt-attr-get.xml mysqli-stmt-attr-set.xml mysqli-stmt-bind-param.xml mysqli-stmt-bind-result.xml mysqli-stmt-close.xml mysqli-stmt-data-seek.xml mysqli-stmt-errno.xml mysqli-stmt-error.xml mysqli-stmt-execute.xml mysqli-stmt-fetch.xml mysqli-stmt-field-count.xml mysqli-stmt-free-result.xml mysqli-stmt-get-warnings.xml mysqli-stmt-insert-id.xml mysqli-stmt-num-rows.xml mysqli-stmt-param-count.xml mysqli-stmt-prepare.xml mysqli-stmt-reset.xml mysqli-stmt-result-metadata.xml mysqli-stmt-send-long-data.xml mysqli-stmt-sqlstate.xml mysqli-stmt-store-result.xml Modified files: /phpdoc/en/reference/mysqli mysqli_stmt.xml Log: Rename functions/mysqli-stmt-*.xml to mysqli_stmt/*.xml

http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/mysqli/mysqli_stmt.xml diff -u phpdoc/en/reference/mysqli/mysqli_stmt.xml:1.3 phpdoc/en/reference/mysqli/mysqli_stmt.xml:1.4 --- phpdoc/en/reference/mysqli/mysqli_stmt.xml:1.3 Wed Dec 26 18:56:29 2007 +++ phpdoc/en/reference/mysqli/mysqli_stmt.xml Wed Jan 2 14:08:21 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <reference xml:id="class.mysqli-stmt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"> <title>The MySQLi_STMT class</title> <titleabbrev>MySQLi_STMT</titleabbrev> @@ -42,34 +42,9 @@ </partintro> -<!-- &reference.mysqli.entities.mysqli-stmt; --> + &reference.mysqli.entities.mysqli-stmt; -<!-- {{{ FIXME: Remove these entities --> -&reference.mysqli.functions.mysqli-stmt-attr-get; -&reference.mysqli.functions.mysqli-stmt-attr-set; -&reference.mysqli.functions.mysqli-stmt-bind-param; -&reference.mysqli.functions.mysqli-stmt-bind-result; -&reference.mysqli.functions.mysqli-stmt-close; -&reference.mysqli.functions.mysqli-stmt-data-seek; -&reference.mysqli.functions.mysqli-stmt-execute; -&reference.mysqli.functions.mysqli-stmt-fetch; -&reference.mysqli.functions.mysqli-stmt-free-result; -&reference.mysqli.functions.mysqli-stmt-get-warnings; -&reference.mysqli.functions.mysqli-stmt-prepare; -&reference.mysqli.functions.mysqli-stmt-reset; -&reference.mysqli.functions.mysqli-stmt-result-metadata; -&reference.mysqli.functions.mysqli-stmt-send-long-data; -&reference.mysqli.functions.mysqli-stmt-affected-rows; -&reference.mysqli.functions.mysqli-stmt-store-result; -&reference.mysqli.functions.mysqli-stmt-errno; -&reference.mysqli.functions.mysqli-stmt-error; -&reference.mysqli.functions.mysqli-stmt-field-count; -&reference.mysqli.functions.mysqli-stmt-insert-id; -&reference.mysqli.functions.mysqli-stmt-num-rows; -&reference.mysqli.functions.mysqli-stmt-param-count; -&reference.mysqli.functions.mysqli-stmt-sqlstate; -<!-- }}} --> - </reference> +</reference> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/affected-rows.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/affected-rows.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/affected-rows.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-affected-rows" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_affected_rows</refname> <refname>mysqli_stmt->affected_rows</refname> <refpurpose>Returns the total number of rows changed, deleted, or inserted by the last executed statement </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style :</para> <methodsynopsis> <type>int</type><methodname>mysqli_stmt_affected_rows</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (property):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <fieldsynopsis><type>int</type><varname>affected_rows</varname></fieldsynopsis> </classsynopsis> <para> Returns the number of rows affected by <literal>INSERT</literal>, <literal>UPDATE</literal>, or <literal>DELETE</literal> query. </para> <para> This function only works with queries which update a table. In order to get the number of rows from a SELECT query, use <function>mysqli_stmt_num_rows</function> instead. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records where updated for an UPDATE/DELETE statement, no rows matched the WHERE clause in the query or that no query has yet been executed. -1 indicates that the query has returned an error. </para> <note> <para> If the number of affected rows is greater than maximal PHP int value, the number of affected rows will be returned as a string value. </para> </note> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</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(); } /* create temp table */ $mysqli->query("CREATE TEMPORARY TABLE myCountry LIKE Country"); $query = "INSERT INTO myCountry SELECT * FROM Country WHERE Code LIKE ?"; /* prepare statement */ if ($stmt = $mysqli->prepare($query)) { /* Bind variable for placeholder */ $code = 'A%'; $stmt->bind_param("s", $code); /* execute statement */ $stmt->execute(); printf("rows inserted: %d\n", $stmt->affected_rows); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</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(); } /* create temp table */ mysqli_query($link, "CREATE TEMPORARY TABLE myCountry LIKE Country"); $query = "INSERT INTO myCountry SELECT * FROM Country WHERE Code LIKE ?"; /* prepare statement */ if ($stmt = mysqli_prepare($link, $query)) { /* Bind variable for placeholder */ $code = 'A%'; mysqli_stmt_bind_param($stmt, "s", $code); /* execute statement */ mysqli_stmt_execute($stmt); printf("rows inserted: %d\n", mysqli_stmt_affected_rows($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ rows inserted: 17 ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_stmt_num_rows</function></member> <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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/attr-get.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/attr-get.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/attr-get.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-attr-get" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_attr_get</refname> <refpurpose></refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>mysqli_stmt_attr_get</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> <methodparam><type>int</type><parameter>attr</parameter></methodparam> </methodsynopsis> &warn.undocumented.func; </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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/attr-set.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/attr-set.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/attr-set.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.mysqli-stmt-attr-set"> <refnamediv> <refname>mysqli_stmt_attr_set</refname> <refpurpose></refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_attr_set</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> <methodparam><type>int</type><parameter>attr</parameter></methodparam> <methodparam><type>int</type><parameter>mode</parameter></methodparam> </methodsynopsis> &warn.undocumented.func; </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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/bind-param.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/bind-param.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/bind-param.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-bind-param" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_bind_param</refname> <refname>stmt->bind_param()</refname> <refpurpose>Binds variables to a prepared statement as parameters</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_bind_param</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> <methodparam><type>string</type><parameter>types</parameter></methodparam> <methodparam><type>mixed</type><parameter role="reference">var1</parameter></methodparam> <methodparam choice="opt"><type>mixed</type><parameter role="reference">...</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>bind_param</methodname> <methodparam><type>string</type><parameter>types</parameter></methodparam> <methodparam><type>mixed</type><parameter role="reference">var1</parameter></methodparam> <methodparam choice="opt"><type>mixed</type><parameter role="reference">...</parameter></methodparam> </methodsynopsis> </classsynopsis> <para> Bind variables for the parameter markers in the SQL statement that was passed to <function>mysqli_prepare</function>. </para> <note> <para> If data size of a variable exceeds max. allowed packet size (max_allowed_packet), you have to specify <literal>b</literal> in <parameter>types</parameter> and use <function>mysqli_stmt_send_long_data</function> to send the data in packets. </para> </note> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; <varlistentry> <term><parameter>types</parameter></term> <listitem> <para> A string that contains one or more characters which specify the types for the corresponding bind variables: <table> <title>Type specification chars</title> <tgroup cols='2'> <thead> <row> <entry>Character</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>i</entry> <entry>corresponding variable has type integer</entry> </row> <row> <entry>d</entry> <entry>corresponding variable has type double</entry> </row> <row> <entry>s</entry> <entry>corresponding variable has type string</entry> </row> <row> <entry>b</entry> <entry>corresponding variable is a blob and will be sent in packets</entry> </row> </tbody> </tgroup> </table> </para> </listitem> </varlistentry> <varlistentry> <term><parameter>var1</parameter></term> <listitem> <para> The number of variables and length of string <parameter>types</parameter> must match the parameters in the statement. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</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(); } $stmt = $mysqli->prepare("INSERT INTO CountryLanguage VALUES (?, ?, ?, ?)"); $stmt->bind_param('sssd', $code, $language, $official, $percent); $code = 'DEU'; $language = 'Bavarian'; $official = "F"; $percent = 11.2; /* execute prepared statement */ $stmt->execute(); printf("%d Row inserted.\n", $stmt->affected_rows); /* close statement and connection */ $stmt->close(); /* Clean up table CountryLanguage */ $mysqli->query("DELETE FROM CountryLanguage WHERE Language='Bavarian'"); printf("%d Row deleted.\n", $mysqli->affected_rows); /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</title> <programlisting role="php"> <![CDATA[ <?php $link = mysqli_connect('localhost', 'my_user', 'my_password', 'world'); /* check connection */ if (!$link) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $stmt = mysqli_prepare($link, "INSERT INTO CountryLanguage VALUES (?, ?, ?, ?)"); mysqli_stmt_bind_param($stmt, 'sssd', $code, $language, $official, $percent); $code = 'DEU'; $language = 'Bavarian'; $official = "F"; $percent = 11.2; /* execute prepared statement */ mysqli_stmt_execute($stmt); printf("%d Row inserted.\n", mysqli_stmt_affected_rows($stmt)); /* close statement and connection */ mysqli_stmt_close($stmt); /* Clean up table CountryLanguage */ mysqli_query($link, "DELETE FROM CountryLanguage WHERE Language='Bavarian'"); printf("%d Row deleted.\n", mysqli_affected_rows($link)); /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ 1 Row inserted. 1 Row deleted. ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_stmt_bind_result</function></member> <member><function>mysqli_stmt_execute</function></member> <member><function>mysqli_stmt_fetch</function></member> <member><function>mysqli_prepare</function></member> <member><function>mysqli_stmt_send_long_data</function></member> <member><function>mysqli_stmt_errno</function></member> <member><function>mysqli_stmt_error</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/bind-result.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/bind-result.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/bind-result.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-bind-result" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_bind_result</refname> <refname>stmt->bind_result()</refname> <refpurpose>Binds variables to a prepared statement for result storage</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_bind_result</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> <methodparam><type>mixed</type><parameter role="reference">var1</parameter></methodparam> <methodparam choice="opt"><type>mixed</type><parameter role="reference">...</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>bind_result</methodname> <methodparam><type>mixed</type><parameter role="reference">var1</parameter></methodparam> <methodparam choice="opt"><type>mixed</type><parameter role="reference">...</parameter></methodparam> </methodsynopsis> </classsynopsis> <para> Binds columns in the result set to variables. </para> <para> When <function>mysqli_stmt_fetch</function> is called to fetch data, the MySQL client/server protocol places the data for the bound columns into the specified variables <parameter>var1, ...</parameter>. </para> <note> <para> Note that all columns must be bound after <function>mysqli_stmt_execute</function> and prior to calling <function>mysqli_stmt_fetch</function>. Depending on column types bound variables can silently change to the corresponding PHP type. </para> <para> A column can be bound or rebound at any time, even after a result set has been partially retrieved. The new binding takes effect the next time <function>mysqli_stmt_fetch</function> is called. </para> </note> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; <varlistentry> <term><parameter>var1</parameter></term> <listitem> <para> The variable to be bound. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</title> <programlisting role="php"> <![CDATA[ <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } /* prepare statement */ if ($stmt = $mysqli->prepare("SELECT Code, Name FROM Country ORDER BY Name LIMIT 5")) { $stmt->execute(); /* bind variables to prepared statement */ $stmt->bind_result($col1, $col2); /* fetch values */ while ($stmt->fetch()) { printf("%s %s\n", $col1, $col2); } /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</title> <programlisting role="php"> <![CDATA[ <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (!$link) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } /* prepare statement */ if ($stmt = mysqli_prepare($link, "SELECT Code, Name FROM Country ORDER BY Name LIMIT 5")) { mysqli_stmt_execute($stmt); /* bind variables to prepared statement */ mysqli_stmt_bind_result($stmt, $col1, $col2); /* fetch values */ while (mysqli_stmt_fetch($stmt)) { printf("%s %s\n", $col1, $col2); } /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ AFG Afghanistan ALB Albania DZA Algeria ASM American Samoa AND Andorra ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_stmt_bind_param</function></member> <member><function>mysqli_stmt_execute</function></member> <member><function>mysqli_stmt_fetch</function></member> <member><function>mysqli_prepare</function></member> <member><function>mysqli_stmt_prepare</function></member> <member><function>mysqli_stmt_init</function></member> <member><function>mysqli_stmt_errno</function></member> <member><function>mysqli_stmt_error</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/close.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/close.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/close.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-close" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_close</refname> <refname>mysqli_stmt->close()</refname> <refpurpose>Closes a prepared statement</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_close</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>close</methodname> <void /> </methodsynopsis> </classsynopsis> <para> Closes a prepared statement. <function>mysqli_stmt_close</function> also deallocates the statement handle. If the current statement has pending or unread results, this function cancels them so that the next query can be executed. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/data-seek.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/data-seek.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/data-seek.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-data-seek" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_data_seek</refname> <refname>stmt->data_seek()</refname> <refpurpose>Seeks to an arbitray row in statement result set</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>void</type><methodname>mysqli_stmt_data_seek</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> <methodparam><type>int</type><parameter>offset</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>void</type><methodname>data_seek</methodname> <methodparam><type>int</type><parameter>offset</parameter></methodparam> </methodsynopsis> </classsynopsis> <para> Seeks to an arbitrary result pointer in the statement result set. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; <varlistentry> <term><parameter>offset</parameter></term> <listitem> <para> Must be between zero and the total number of rows minus one (0.. <function>mysqli_stmt_num_rows</function> - 1). </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.void; </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER BY Name"; if ($stmt = $mysqli->prepare($query)) { /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($name, $code); /* store result */ $stmt->store_result(); /* seek to row no. 400 */ $stmt->data_seek(399); /* fetch values */ $stmt->fetch(); printf ("City: %s Countrycode: %s\n", $name, $code); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER BY Name"; if ($stmt = mysqli_prepare($link, $query)) { /* execute query */ mysqli_stmt_execute($stmt); /* bind result variables */ mysqli_stmt_bind_result($stmt, $name, $code); /* store result */ mysqli_stmt_store_result($stmt); /* seek to row no. 400 */ mysqli_stmt_data_seek($stmt, 399); /* fetch values */ mysqli_stmt_fetch($stmt); printf ("City: %s Countrycode: %s\n", $name, $code); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ City: Benin City Countrycode: NGA ]]> </screen> </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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/errno.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/errno.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/errno.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-errno" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_errno</refname> <refname>mysqli_stmt->errno</refname> <refpurpose>Returns the error code for the most recent statement call</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style :</para> <methodsynopsis> <type>int</type><methodname>mysqli_stmt_errno</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (property):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <fieldsynopsis><type>int</type><varname>errno</varname></fieldsynopsis> </classsynopsis> <para> Returns the error code for the most recently invoked statement function that can succeed or fail. </para> <para> Client error message numbers are listed in the MySQL <filename>errmsg.h</filename> header file, server error message numbers are listed in <filename>mysqld_error.h</filename>. In the MySQL source distribution you can find a complete list of error messages and error numbers in the file <filename>Docs/mysqld_error.txt</filename>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> An error code value. Zero means no error occurred. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $mysqli->query("CREATE TABLE myCountry LIKE Country"); $mysqli->query("INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = $mysqli->prepare($query)) { /* drop table */ $mysqli->query("DROP TABLE myCountry"); /* execute query */ $stmt->execute(); printf("Error: %d.\n", $stmt->errno); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } mysqli_query($link, "CREATE TABLE myCountry LIKE Country"); mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = mysqli_prepare($link, $query)) { /* drop table */ mysqli_query($link, "DROP TABLE myCountry"); /* execute query */ mysqli_stmt_execute($stmt); printf("Error: %d.\n", mysqli_stmt_errno($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ Error: 1146. ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_stmt_error</function></member> <member><function>mysqli_stmt_sqlstate</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/error.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/error.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/error.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-error" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_error</refname> <refname>mysqli_stmt->error</refname> <refpurpose>Returns a string description for last statement error</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>string</type><methodname>mysqli_stmt_error</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (property):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <fieldsynopsis><type>string</type><varname>error</varname></fieldsynopsis> </classsynopsis> <para> Returns a containing the error message for the most recently invoked statement function that can succeed or fail. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> A string that describes the error. An empty string if no error occurred. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $mysqli->query("CREATE TABLE myCountry LIKE Country"); $mysqli->query("INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = $mysqli->prepare($query)) { /* drop table */ $mysqli->query("DROP TABLE myCountry"); /* execute query */ $stmt->execute(); printf("Error: %s.\n", $stmt->error); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } mysqli_query($link, "CREATE TABLE myCountry LIKE Country"); mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = mysqli_prepare($link, $query)) { /* drop table */ mysqli_query($link, "DROP TABLE myCountry"); /* execute query */ mysqli_stmt_execute($stmt); printf("Error: %s.\n", mysqli_stmt_error($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ Error: Table 'world.myCountry' doesn't exist. ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_stmt_errno</function></member> <member><function>mysqli_stmt_sqlstate</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/execute.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/execute.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/execute.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-execute" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_execute</refname> <refname>stmt->execute()</refname> <refpurpose>Executes a prepared Query</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_execute</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>execute</methodname> <void /> </methodsynopsis> </classsynopsis> <para> Executes a query that has been previously prepared using the <function>mysqli_prepare</function> function. When executed any parameter markers which exist will automatically be replaced with the appropiate data. </para> <para> If the statement is <literal>UPDATE</literal>, <literal>DELETE</literal>, or <literal>INSERT</literal>, the total number of affected rows can be determined by using the <function>mysqli_stmt_affected_rows</function> function. Likewise, if the query yields a result set the <function>mysqli_stmt_fetch</function> function is used. </para> <note> <para> When using <function>mysqli_stmt_execute</function>, the <function>mysqli_stmt_fetch</function> function must be used to fetch the data prior to performing any additional queries. </para> </note> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</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(); } $mysqli->query("CREATE TABLE myCity LIKE City"); /* Prepare an insert statement */ $query = "INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)"; $stmt = $mysqli->prepare($query); $stmt->bind_param("sss", $val1, $val2, $val3); $val1 = 'Stuttgart'; $val2 = 'DEU'; $val3 = 'Baden-Wuerttemberg'; /* Execute the statement */ $stmt->execute(); $val1 = 'Bordeaux'; $val2 = 'FRA'; $val3 = 'Aquitaine'; /* Execute the statement */ $stmt->execute(); /* close statement */ $stmt->close(); /* retrieve all rows from myCity */ $query = "SELECT Name, CountryCode, District FROM myCity"; if ($result = $mysqli->query($query)) { while ($row = $result->fetch_row()) { printf("%s (%s,%s)\n", $row[0], $row[1], $row[2]); } /* free result set */ $result->close(); } /* remove table */ $mysqli->query("DROP TABLE myCity"); /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</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(); } mysqli_query($link, "CREATE TABLE myCity LIKE City"); /* Prepare an insert statement */ $query = "INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)"; $stmt = mysqli_prepare($link, $query); mysqli_stmt_bind_param($stmt, "sss", $val1, $val2, $val3); $val1 = 'Stuttgart'; $val2 = 'DEU'; $val3 = 'Baden-Wuerttemberg'; /* Execute the statement */ mysqli_stmt_execute($stmt); $val1 = 'Bordeaux'; $val2 = 'FRA'; $val3 = 'Aquitaine'; /* Execute the statement */ mysqli_stmt_execute($stmt); /* close statement */ mysqli_stmt_close($stmt); /* retrieve all rows from myCity */ $query = "SELECT Name, CountryCode, District FROM myCity"; if ($result = mysqli_query($link, $query)) { while ($row = mysqli_fetch_row($result)) { printf("%s (%s,%s)\n", $row[0], $row[1], $row[2]); } /* free result set */ mysqli_free_result($result); } /* remove table */ mysqli_query($link, "DROP TABLE myCity"); /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ Stuttgart (DEU,Baden-Wuerttemberg) Bordeaux (FRA,Aquitaine) ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_prepare</function></member> <member><function>mysqli_stmt_bind_param</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/fetch.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/fetch.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/fetch.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-fetch" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_fetch</refname> <refname>stmt->fetch()</refname> <refpurpose>Fetch results from a prepared statement into the bound variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_fetch</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>fetch</methodname> <void /> </methodsynopsis> </classsynopsis> <para> Fetch the result from a prepared statement into the variables bound by <function>mysqli_stmt_bind_result</function>. </para> <note> <para> Note that all columns must be bound by the application before calling <function>mysqli_stmt_fetch</function>. </para> </note> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <table> &reftitle.returnvalues; <tgroup cols='2'> <thead> <row> <entry>Value</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>&true;</entry> <entry>Success. Data has been fetched</entry> </row> <row> <entry>&false;</entry> <entry>Error occured</entry> </row> <row> <entry>&null;</entry> <entry>No more rows/data exists or data truncation occurred</entry> </row> </tbody> </tgroup> </table> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</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(); } $query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 150,5"; if ($stmt = $mysqli->prepare($query)) { /* execute statement */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($name, $code); /* fetch values */ while ($stmt->fetch()) { printf ("%s (%s)\n", $name, $code); } /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</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(); } $query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 150,5"; if ($stmt = mysqli_prepare($link, $query)) { /* execute statement */ mysqli_stmt_execute($stmt); /* bind result variables */ mysqli_stmt_bind_result($stmt, $name, $code); /* fetch values */ while (mysqli_stmt_fetch($stmt)) { printf ("%s (%s)\n", $name, $code); } /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ Rockford (USA) Tallahassee (USA) Salinas (USA) Santa Clarita (USA) Springfield (USA) ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_prepare</function></member> <member><function>mysqli_stmt_errno</function></member> <member><function>mysqli_stmt_error</function></member> <member><function>mysqli_stmt_bind_result</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/field-count.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/field-count.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/field-count.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-field-count" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_field_count</refname> <refpurpose>Returns the number of field in the given statement</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>mysqli_stmt_field_count</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> &warn.undocumented.func; </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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/free-result.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/free-result.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/free-result.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-free-result" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_free_result</refname> <refname>stmt->free_result()</refname> <refpurpose>Frees stored result memory for the given statement handle</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>void</type><methodname>mysqli_stmt_free_result</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>void</type><methodname>free_result</methodname> <void /> </methodsynopsis> </classsynopsis> <para> Frees the result memory associated with the statement, which was allocated by <function>mysqli_stmt_store_result</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.void; </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_stmt_store_result</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/get-warnings.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/get-warnings.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/get-warnings.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-get-warnings" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_get_warnings</refname> <refpurpose></refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>object</type><methodname>mysqli_stmt_get_warnings</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> &warn.undocumented.func; </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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/insert-id.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/insert-id.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/insert-id.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-insert-id" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_insert_id</refname> <refpurpose>Get the ID generated from the previous INSERT operation</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>mixed</type><methodname>mysqli_stmt_insert_id</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> &warn.undocumented.func; </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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/num-rows.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/num-rows.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/num-rows.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-num-rows" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_num_rows</refname> <refname>stmt->num_rows</refname> <refpurpose>Return the number of rows in statements result set</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style :</para> <methodsynopsis> <type>int</type><methodname>mysqli_stmt_num_rows</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (property):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <fieldsynopsis><type>int</type><varname>num_rows</varname></fieldsynopsis> </classsynopsis> <para> Returns the number of rows in the result set. The use of <function>mysqli_stmt_num_rows</function> depends on whether or not you used <function>mysqli_stmt_store_result</function> to buffer the entire result set in the statement handle. </para> <para> If you use <function>mysqli_stmt_store_result</function>, <function>mysqli_stmt_num_rows</function> may be called immediately. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> An integer representing the number of rows in result set. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = $mysqli->prepare($query)) { /* execute query */ $stmt->execute(); /* store result */ $stmt->store_result(); printf("Number of rows: %d.\n", $stmt->num_rows); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = mysqli_prepare($link, $query)) { /* execute query */ mysqli_stmt_execute($stmt); /* store result */ mysqli_stmt_store_result($stmt); printf("Number of rows: %d.\n", mysqli_stmt_num_rows($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ Number of rows: 20. ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_stmt_affected_rows</function></member> <member><function>mysqli_prepare</function></member> <member><function>mysqli_stmt_store_result</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/param-count.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/param-count.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/param-count.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-param-count" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_param_count</refname> <refname>stmt->param_count</refname> <refpurpose>Returns the number of parameter for the given statement</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>int</type><methodname>mysqli_stmt_param_count</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (property):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <fieldsynopsis><type>int</type><varname>param_count</varname></fieldsynopsis> </classsynopsis> <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>Object oriented style</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>Procedural style</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> </example> &example.outputs; <screen> <![CDATA[ Statement has 2 markers. ]]> </screen> </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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/prepare.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/prepare.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/prepare.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-prepare" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_prepare</refname> <refname>stmt->prepare()</refname> <refpurpose>Prepare a SQL statement for execution</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedure style:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_prepare</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> <methodparam><type>string</type><parameter>query</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method)</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>mixed</type><methodname>prepare</methodname> <methodparam><type>string</type><parameter>query</parameter></methodparam> </methodsynopsis> </classsynopsis> <para> Prepares the SQL query pointed to by the null-terminated string query. </para> <para> The parameter markers must be bound to application variables using <function>mysqli_stmt_bind_param</function> and/or <function>mysqli_stmt_bind_result</function> before executing the statement or fetching rows. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; <varlistentry> <term><parameter>query</parameter></term> <listitem> <para> The query, as a string. It must consist of a single SQL statement. </para> <para> You can include one or more parameter markers in the SQL statement by embedding question mark (<literal>?</literal>) characters at the appropriate positions. </para> <note> <para> You should not add a terminating semicolon or <literal>\g</literal> to the statement. </para> </note> <note> <para> The markers are legal only in certain places in SQL statements. For example, they are allowed in the VALUES() list of an INSERT statement (to specify column values for a row), or in a comparison with a column in a WHERE clause to specify a comparison value. </para> <para> However, they are not allowed for identifiers (such as table or column names), in the select list that names the columns to be returned by a SELECT statement), or to specify both operands of a binary operator such as the <literal>=</literal> equal sign. The latter restriction is necessary because it would be impossible to determine the parameter type. In general, parameters are legal only in Data Manipulation Languange (DML) statements, and not in Data Defination Language (DDL) statements. </para> </note> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</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(); } $city = "Amersfoort"; /* create a prepared statement */ $stmt = $mysqli->stmt_init(); if ($stmt->prepare("SELECT District FROM City WHERE Name=?")) { /* bind parameters for markers */ $stmt->bind_param("s", $city); /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($district); /* fetch value */ $stmt->fetch(); printf("%s is in district %s\n", $city, $district); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</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(); } $city = "Amersfoort"; /* create a prepared statement */ $stmt = mysqli_stmt_init($link); if (mysqli_stmt_prepare($stmt, 'SELECT District FROM City WHERE Name=?')) { /* bind parameters for markers */ mysqli_stmt_bind_param($stmt, "s", $city); /* execute query */ mysqli_stmt_execute($stmt); /* bind result variables */ mysqli_stmt_bind_result($stmt, $district); /* fetch value */ mysqli_stmt_fetch($stmt); printf("%s is in district %s\n", $city, $district); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ Amersfoort is in district Utrecht ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <function>mysqli_stmt_init</function>, <function>mysqli_stmt_execute</function>, <function>mysqli_stmt_fetch</function>, <function>mysqli_stmt_bind_param</function>, <function>mysqli_stmt_bind_result</function> <function>mysqli_stmt_close</function>. </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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/reset.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/reset.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/reset.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-reset" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_reset</refname> <refname>stmt->reset()</refname> <refpurpose>Resets a prepared statement</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_reset</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>reset</methodname> <void /> </methodsynopsis> </classsynopsis> <para> Resets a prepared statement on client and server to state after prepare. </para> <para> For now this is mainly used to reset data sent with <function>mysqli_stmt_send_long_data</function>. </para> <para> To prepare a statement with another query use function <function>mysqli_stmt_prepare</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/result-metadata.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/result-metadata.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/result-metadata.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-result-metadata" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_result_metadata</refname> <refname>stmt->result_metadata()</refname> <refpurpose>Returns result set metadata from a prepared statement</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>mysqli_result</type><methodname>mysqli_stmt_result_metadata</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>mysqli_result</type><methodname>result_metadata</methodname> <void /> </methodsynopsis> </classsynopsis> <para> If a statement passed to <function>mysqli_prepare</function> is one that produces a result set, <function>mysqli_stmt_result_metadata</function> returns the result object that can be used to process the meta information such as total number of fields and individual field information. </para> <note> <para>This result set pointer can be passed as an argument to any of the field-based functions that process result set metadata, such as: <itemizedlist> <listitem><para><function>mysqli_num_fields</function></para></listitem> <listitem><para><function>mysqli_fetch_field</function></para></listitem> <listitem><para><function>mysqli_fetch_field_direct</function></para></listitem> <listitem><para><function>mysqli_fetch_fields</function></para></listitem> <listitem><para><function>mysqli_field_count</function></para></listitem> <listitem><para><function>mysqli_field_seek</function></para></listitem> <listitem><para><function>mysqli_field_tell</function></para></listitem> <listitem><para><function>mysqli_free_result</function></para></listitem> </itemizedlist> </para> </note> <para> The result set structure should be freed when you are done with it, which you can do by passing it to <function>mysqli_free_result</function> </para> <note> <para> The result set returned by <function>mysqli_stmt_result_metadata</function> contains only metadata. It does not contain any row results. The rows are obtained by using the statement handle with <function>mysqli_stmt_fetch</function>. </para> </note> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns a result object or &false; if an error occured. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>Object oriented style</title> <programlisting role='php'> <![CDATA[ <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "test"); $mysqli->query("DROP TABLE IF EXISTS friends"); $mysqli->query("CREATE TABLE friends (id int, name varchar(20))"); $mysqli->query("INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')"); $stmt = $mysqli->prepare("SELECT id, name FROM friends"); $stmt->execute(); /* get resultset for metadata */ $result = $stmt->result_metadata(); /* retrieve field information from metadata result set */ $field = $result->fetch_field(); printf("Fieldname: %s\n", $field->name); /* close resultset */ $result->close(); /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</title> <programlisting role='php'> <![CDATA[ <?php $link = mysqli_connect("localhost", "my_user", "my_password", "test"); mysqli_query($link, "DROP TABLE IF EXISTS friends"); mysqli_query($link, "CREATE TABLE friends (id int, name varchar(20))"); mysqli_query($link, "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')"); $stmt = mysqli_prepare($link, "SELECT id, name FROM friends"); mysqli_stmt_execute($stmt); /* get resultset for metadata */ $result = mysqli_stmt_result_metadata($stmt); /* retrieve field information from metadata result set */ $field = mysqli_fetch_field($result); printf("Fieldname: %s\n", $field->name); /* close resultset */ mysqli_free_result($result); /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_prepare</function></member> <member><function>mysqli_free_result</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/send-long-data.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/send-long-data.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/send-long-data.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-send-long-data" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_send_long_data</refname> <refname>stmt->send_long_data()</refname> <refpurpose>Send data in blocks</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_send_long_data</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> <methodparam><type>int</type><parameter>param_nr</parameter></methodparam> <methodparam><type>string</type><parameter>data</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method)</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>send_long_data</methodname> <methodparam><type>int</type><parameter>param_nr</parameter></methodparam> <methodparam><type>string</type><parameter>data</parameter></methodparam> </methodsynopsis> </classsynopsis> <para> Allows to send parameter data to the server in pieces (or chunks), e.g. if the size of a blob exceeds the size of <literal>max_allowed_packet</literal>. This function can be called multiple times to send the parts of a character or binary data value for a column, which must be one of the TEXT or BLOB datatypes. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; <varlistentry> <term><parameter>param_nr</parameter></term> <listitem> <para> Indicates which parameter to associate the data with. Parameters are numbered beginning with 0. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>data</parameter></term> <listitem> <para> A string containing data to be sent. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</title> <programlisting role="php"> <![CDATA[ <?php $stmt = $mysqli->prepare("INSERT INTO messages (message) VALUES (?)"); $null = NULL; $stmt->bind_param("b", $null); $fp = fopen("messages.txt", "r"); while (!feof($fp)) { $stmt->send_long_data(0, fread($fp, 8192)); } fclose($fp); $stmt->execute(); ?> ]]> </programlisting> </example> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_prepare</function></member> <member><function>mysqli_stmt_bind_param</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/sqlstate.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/sqlstate.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/sqlstate.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-sqlstate" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>mysqli_stmt_sqlstate</refname> <refname>mysqli_stmt->sqlstate()</refname> <refpurpose>Returns SQLSTATE error from previous statement operation</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>mysqli_stmt_sqlstate</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (property):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <fieldsynopsis><type>string</type><varname>sqlstate</varname></fieldsynopsis> </classsynopsis> <para> Returns a string containing the SQLSTATE error code for the most recently invoked prepared statement function that can succeed or fail. The error code consists of five characters. <literal>'00000'</literal> means no error. The values are specified by ANSI SQL and ODBC. For a list of possible values, see <link xlink:href="&url.mysql.docs.error;">&url.mysql.docs.error;</link>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. <literal>'00000'</literal> means no error. </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; <note> <para> Note that not all MySQL errors are yet mapped to SQLSTATE's. The value <literal>HY000</literal> (general error) is used for unmapped errors. </para> </note> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $mysqli->query("CREATE TABLE myCountry LIKE Country"); $mysqli->query("INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = $mysqli->prepare($query)) { /* drop table */ $mysqli->query("DROP TABLE myCountry"); /* execute query */ $stmt->execute(); printf("Error: %s.\n", $stmt->sqlstate); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } mysqli_query($link, "CREATE TABLE myCountry LIKE Country"); mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = mysqli_prepare($link, $query)) { /* drop table */ mysqli_query($link, "DROP TABLE myCountry"); /* execute query */ mysqli_stmt_execute($stmt); printf("Error: %s.\n", mysqli_stmt_sqlstate($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ Error: 42S02. ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_stmt_errno</function></member> <member><function>mysqli_stmt_error</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:"../../../../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 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/mysqli_stmt/store-result.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/mysqli/mysqli_stmt/store-result.xml +++ phpdoc/en/reference/mysqli/mysqli_stmt/store-result.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.mysqli-stmt-store-result" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>mysqli_stmt_store_result</refname> <refname>mysqli_stmt->store_result()</refname> <refpurpose>Transfers a result set from a prepared statement</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para>Procedural style:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_store_result</methodname> <methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Object oriented style (method):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>store_result</methodname> <void /> </methodsynopsis> </classsynopsis> <para> You must call <function>mysqli_stmt_store_result</function> for every query that successfully produces a result set (<literal>SELECT, SHOW, DESCRIBE, EXPLAIN</literal>), and only if you want to buffer the complete result set by the client, so that the subsequent <function>mysqli_stmt_fetch</function> call returns buffered data. </para> <note> <para> It is unnecessary to call <function>mysqli_stmt_store_result</function> for other queries, but if you do, it will not harm or cause any notable performance in all cases. You can detect whether the query produced a result set by checking if <function>mysqli_stmt_result_metadata</function> returns NULL. </para> </note> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysqli.stmt.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>Object oriented style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = $mysqli->prepare($query)) { /* execute query */ $stmt->execute(); /* store result */ $stmt->store_result(); printf("Number of rows: %d.\n", $stmt->num_rows); /* free result */ $stmt->free_result(); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Procedural style</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = mysqli_prepare($link, $query)) { /* execute query */ mysqli_stmt_execute($stmt); /* store result */ mysqli_stmt_store_result($stmt); printf("Number of rows: %d.\n", mysqli_stmt_num_rows($stmt)); /* free result */ mysqli_stmt_free_result($stmt); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> &example.outputs; <screen> <![CDATA[ Number of rows: 20. ]]> </screen> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysqli_prepare</function></member> <member><function>mysqli_stmt_result_metadata</function></member> <member><function>mysqli_stmt_fetch</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:"../../../../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 -->
« previous php.doc.cvs (#981) next »