[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-cvs
Subject:    [DOC-CVS] =?utf-8?q?svn:_/phpdoc/en/trunk/reference/sqlite3/sqlite3stmt/_bindparam.xml?=
From:       Christoph_Michael_Becker <cmb () php ! net>
Date:       2018-07-26 15:33:23
Message-ID: svn-cmb-1532619203-345400-1139348703 () svn ! php ! net
[Download RAW message or body]

cmb                                      Thu, 26 Jul 2018 15:33:23 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=345400

Log:
Add usage example

Changed paths:
    U   phpdoc/en/trunk/reference/sqlite3/sqlite3stmt/bindparam.xml

Modified: phpdoc/en/trunk/reference/sqlite3/sqlite3stmt/bindparam.xml
===================================================================
--- phpdoc/en/trunk/reference/sqlite3/sqlite3stmt/bindparam.xml	2018-07-26 15:22:39 UTC (rev 345399)
+++ phpdoc/en/trunk/reference/sqlite3/sqlite3stmt/bindparam.xml	2018-07-26 15:33:23 UTC (rev 345400)
@@ -110,6 +110,54 @@
   </para>
  </refsect1>

+ <refsect1 role="examples">
+  &reftitle.examples;
+  <para>
+   <example>
+    <title><function>SQLite3Stmt::bindParam</function> Usage</title>
+    <para>
+     This example shows how a single prepared statement with a single parameter
+     binding can be used to insert multiple rows with different values.
+    </para>
+    <programlisting role="php">
+<![CDATA[
+<?php
+$db = new SQLite3(':memory:');
+$db->exec("CREATE TABLE foo (bar TEXT)");
+
+$stmt = $db->prepare("INSERT INTO foo VALUES (:bar)");
+$stmt->bindParam(':bar', $bar, SQLITE3_TEXT);
+
+$bar = 'baz';
+$stmt->execute();
+
+$bar = 42;
+$stmt->execute();
+
+$res = $db->query("SELECT * FROM foo");
+while (($row = $res->fetchArray(SQLITE3_ASSOC))) {
+    var_dump($row);
+}
+?>
+]]>
+    </programlisting>
+    &example.outputs;
+    <screen role="php">
+<![CDATA[
+array(1) {
+  ["bar"]=>
+  string(3) "baz"
+}
+array(1) {
+  ["bar"]=>
+  string(2) "42"
+}
+]]>
+    </screen>
+   </example>
+  </para>
+ </refsect1>
+
  <refsect1 role="seealso">
   &reftitle.seealso;
   <simplelist>



-- 
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic