⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.sqlite-fetch-single.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Fetches the first column of a result set as a string</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-fetch-object.html">sqlite_fetch_object</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-fetch-string.html">sqlite_fetch_string</a></div> <div class="up"><a href="ref.sqlite.html">SQLite Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.sqlite-fetch-single" class="refentry"> <div class="refnamediv">  <h1 class="refname">sqlite_fetch_single</h1>  <h1 class="refname">SQLiteResult-&gt;fetchSingle</h1>  <h1 class="refname">SQLiteUnbuffered-&gt;fetchSingle</h1>  <p class="verinfo">(PHP 5, PECL sqlite:1.0.1-1.0.3)</p><p class="refpurpose"><span class="refname">sqlite_fetch_single</span> -- <span class="refname">SQLiteResult-&gt;fetchSingle</span> -- <span class="refname">SQLiteUnbuffered-&gt;fetchSingle</span> &mdash; <span class="dc-title">Fetches the first column of a result set as a string</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">string</span> <span class="methodname"><b><b>sqlite_fetch_single</b></b></span>    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$result</tt></span>   [, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$decode_binary</tt></span>  ] )</div>  <p class="para rdfs-comment">Object oriented style (method):</p>  <div class="classsynopsis">   <div class="ooclass"><b class="classname">SQLiteResult</b></div>   <div class="methodsynopsis dc-description">    <span class="type">string</span> <span class="methodname"><b><b>fetchSingle</b></b></span>     ([ <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$decode_binary</tt></span>   ] )</div>  </div>  <div class="classsynopsis">   <div class="ooclass"><b class="classname">SQLiteUnbuffered</b></div>   <div class="methodsynopsis dc-description">    <span class="type">string</span> <span class="methodname"><b><b>fetchSingle</b></b></span>     ([ <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$decode_binary</tt></span>   ] )</div>  </div>  <p class="para">   <b>sqlite_fetch_single()</b> is identical to   <a href="function.sqlite-fetch-array.html" class="function">sqlite_fetch_array()</a> except that it returns the value   of the first column of the rowset.  </p>  <p class="para">   This is the most optimal way to retrieve data when you are only   interested in the values from a single column of data.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">result</tt></i></span>     <dd>      <p class="para">       The SQLite result resource.  This parameter is not required when using       the object-oriented method.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">decode_binary</tt></i></span>     <dd>      <p class="para">When the <i><tt class="parameter">decode_binary</tt></i>parameter is set to <b><tt>TRUE</tt></b> (the default), PHP will decode the binary encodingit applied to the data if it was encoded using the<a href="function.sqlite-escape-string.html" class="function">sqlite_escape_string()</a>.  You should normally leave thisvalue at its default, unless you are interoperating with databases created byother sqlite capable applications.</p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 A <b>sqlite_fetch_single()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">$dbhandle&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlite_open</span><span style="color: #007700">(</span><span style="color: #DD0000">'mysqlitedb'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0666</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$sqliteerror</span><span style="color: #007700">))&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$sql&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"SELECT&nbsp;id&nbsp;FROM&nbsp;sometable&nbsp;WHERE&nbsp;id&nbsp;=&nbsp;42"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$res&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlite_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbhandle</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$sql</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">sqlite_num_rows</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">)&nbsp;&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">sqlite_fetch_single</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;42<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">}<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">sqlite_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbhandle</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.sqlite-fetch-array.html" class="function" rel="rdfs-seeAlso">sqlite_fetch_array()</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-fetch-object.html">sqlite_fetch_object</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-fetch-string.html">sqlite_fetch_string</a></div> <div class="up"><a href="ref.sqlite.html">SQLite Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -