📄 function.dbx-query.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Send a query and fetch all results (if any)</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.dbx-fetch-row.html">dbx_fetch_row</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.dbx-sort.html">dbx_sort</a></div> <div class="up"><a href="ref.dbx.html">dbx Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.dbx-query" class="refentry"> <div class="refnamediv"> <h1 class="refname">dbx_query</h1> <p class="verinfo">(PHP 4 >= 4.0.6, PHP 5 <= 5.0.5, PECL dbx:1.1.0)</p><p class="refpurpose"><span class="refname">dbx_query</span> — <span class="dc-title">Send a query and fetch all results (if any)</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><b><b>dbx_query</b></b></span> ( <span class="methodparam"><span class="type">object</span> <tt class="parameter">$link_identifier</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$sql_statement</tt></span> [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$flags</tt></span> ] )</div> <p class="para rdfs-comment"> Sends a query and fetch all results. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">link_identifier</tt></i></span> <dd> <p class="para"> The DBX link object returned by <a href="function.dbx-connect.html" class="function">dbx_connect()</a> </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">sql_statement</tt></i></span> <dd> <p class="para"> SQL statement. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">flags</tt></i></span> <dd> <p class="para"> The <i><tt class="parameter">flags</tt></i> parameter is used to control the amount of information that is returned. It may be any combination of the following constants with the bitwise OR operator (|). The DBX_COLNAMES_* flags override the dbx.colnames_case setting from <var class="filename">php.ini</var>. <dl> <dt> <span class="term"> <b><tt>DBX_RESULT_INDEX</tt></b> </span> <dd> <span class="simpara"> It is <em class="emphasis">always</em> set, that is, the returned object has a <span class="property">data</span> property which is a 2 dimensional array indexed numerically. For example, in the expression <i>data[2][3]</i> <i>2</i> stands for the row (or record) number and <i>3</i> stands for the column (or field) number. The first row and column are indexed at 0. </span> <span class="simpara"> If <b><tt>DBX_RESULT_ASSOC</tt></b> is also specified, the returning object contains the information related to <b><tt>DBX_RESULT_INFO</tt></b> too, even if it was not specified. </span> </dd> </dt> <dt> <span class="term"> <b><tt>DBX_RESULT_INFO</tt></b> </span> <dd> <span class="simpara"> It provides info about columns, such as field names and field types. </span> </dd> </dt> <dt> <span class="term"> <b><tt>DBX_RESULT_ASSOC</tt></b> </span> <dd> <span class="simpara"> It effects that the field values can be accessed with the respective column names used as keys to the returned object's <span class="property">data</span> property. </span> <span class="simpara"> Associated results are actually references to the numerically indexed data, so modifying <i>data[0][0]</i> causes that <i>data[0]['field_name_for_first_column']</i> is modified as well. </span> </dd> </dt> <dt> <span class="term"> <b><tt>DBX_RESULT_UNBUFFERED</tt></b> (PHP 5) </span> <dd> <span class="simpara"> This flag will not create the <span class="property">data</span> property, and the <span class="property">rows</span> property will initially be 0. Use this flag for large datasets, and use <a href="function.dbx-fetch-row.html" class="function">dbx_fetch_row()</a> to retrieve the results row by row. </span> <span class="simpara"> The <a href="function.dbx-fetch-row.html" class="function">dbx_fetch_row()</a> function will return rows that are conformant to the flags set with this query. Incidentally, it will also update the <span class="property">rows</span> each time it is called. </span> </dd> </dt> <dt> <span class="term"> <b><tt>DBX_COLNAMES_UNCHANGED</tt></b> (available from PHP 4.3.0) </span> <dd> <span class="simpara"> The case of the returned column names will not be changed. </span> </dd> </dt> <dt> <span class="term"> <b><tt>DBX_COLNAMES_UPPERCASE</tt></b> (available from PHP 4.3.0) </span> <dd> <span class="simpara"> The case of the returned column names will be changed to uppercase. </span> </dd> </dt> <dt> <span class="term"> <b><tt>DBX_COLNAMES_LOWERCASE</tt></b> (available from PHP 4.3.0) </span> <dd> <span class="simpara"> The case of the returned column names will be changed to lowercase. </span> </dd> </dt> </dl> Note that <b><tt>DBX_RESULT_INDEX</tt></b> is always used, regardless of the actual value of <i><tt class="parameter">flags</tt></i> parameter. This means that only the following combinations are effective:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -