<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.mysqli.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'mysqli.real-query.php',
    1 => 'mysqli::real_query',
    2 => '执行一个mysql查询',
  ),
  'up' => 
  array (
    0 => 'class.mysqli.php',
    1 => 'mysqli',
  ),
  'prev' => 
  array (
    0 => 'mysqli.real-escape-string.php',
    1 => 'mysqli::real_escape_string',
  ),
  'next' => 
  array (
    0 => 'mysqli.reap-async-query.php',
    1 => 'mysqli::reap_async_query',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/mysqli/mysqli/real-query.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysqli.real-query" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mysqli::real_query</h1>
  <h1 class="refname">mysqli_real_query</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mysqli::real_query</span> -- <span class="refname">mysqli_real_query</span> &mdash; <span class="dc-title">执行一个mysql查询</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mysqli.real-query-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>mysqli::real_query</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$query</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">过程化风格</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>mysqli_real_query</strong></span>(<span class="methodparam"><span class="type"><a href="class.mysqli.php" class="type mysqli">mysqli</a></span> <code class="parameter">$mysql</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$query</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   对数据库执行单条查询，其结果可以使用 <span class="function"><a href="mysqli.store-result.php" class="function">mysqli_store_result()</a></span> 或 <span class="function"><a href="mysqli.use-result.php" class="function">mysqli_use_result()</a></span> 检索或存储。
  </p>
  <div class="warning"><strong class="warning">警告</strong>
<h1 class="title">Security warning: SQL injection</h1><p class="para">If the query contains any variable
input then <a href="mysqli.quickstart.prepared-statements.php" class="link">parameterized
prepared statements</a> should be used instead. Alternatively, the
data must be properly formatted and all strings must be escaped using
the <span class="function"><a href="mysqli.real-escape-string.php" class="function">mysqli_real_escape_string()</a></span>
function.</p></div>
  <p class="para">
   为了确定给定的查询是否应返回结果集，参阅 <span class="function"><a href="mysqli.field-count.php" class="function">mysqli_field_count()</a></span>。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mysqli.real-query-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    <dt>
<code class="parameter">mysql</code></dt><dd><p class="para">仅以过程化样式：由 <span class="function"><a href="function.mysqli-connect.php" class="function">mysqli_connect()</a></span> 或
<span class="function"><a href="mysqli.init.php" class="function">mysqli_init()</a></span> 返回的 <span class="classname"><a href="class.mysqli.php" class="classname">mysqli</a></span> 对象。</p></dd>
    
     <dt><code class="parameter">query</code></dt>
     <dd>
      <p class="para">
       查询字符串。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mysqli.real-query-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>， 或者在失败时返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mysqli.real-query-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
If mysqli error reporting is enabled (<strong><code><a href="mysqli.constants.php#constant.mysqli-report-error">MYSQLI_REPORT_ERROR</a></code></strong>) and the requested operation fails,
a warning is generated. If, in addition, the mode is set to <strong><code><a href="mysqli.constants.php#constant.mysqli-report-strict">MYSQLI_REPORT_STRICT</a></code></strong>,
a <span class="classname"><a href="class.mysqli-sql-exception.php" class="classname">mysqli_sql_exception</a></span> is thrown instead.</p>
 </div>


 <div class="refsect1 seealso" id="refsect1-mysqli.real-query-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="mysqli.query.php" class="function" rel="rdfs-seeAlso">mysqli_query()</a> - 对数据库执行查询</span></li>
    <li><span class="function"><a href="mysqli.store-result.php" class="function" rel="rdfs-seeAlso">mysqli_store_result()</a> - 传输上次查询的结果集</span></li>
    <li><span class="function"><a href="mysqli.use-result.php" class="function" rel="rdfs-seeAlso">mysqli_use_result()</a> - Initiate a result set retrieval</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>