<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'mysqli.store-result.php',
    1 => 'mysqli::store_result',
    2 => '直近のクエリから結果セットを転送する',
  ),
  'up' => 
  array (
    0 => 'class.mysqli.php',
    1 => 'mysqli',
  ),
  'prev' => 
  array (
    0 => 'mysqli.stmt-init.php',
    1 => 'mysqli::stmt_init',
  ),
  'next' => 
  array (
    0 => 'mysqli.thread-id.php',
    1 => 'mysqli::$thread_id',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/mysqli/mysqli/store-result.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysqli.store-result" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mysqli::store_result</h1>
  <h1 class="refname">mysqli_store_result</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mysqli::store_result</span> -- <span class="refname">mysqli_store_result</span> &mdash; <span class="dc-title">直近のクエリから結果セットを転送する</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mysqli.store-result-description">
  <h3 class="title">説明</h3>
  <p class="para">オブジェクト指向型</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>mysqli::store_result</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code><span class="initializer"> = 0</span></span>): <span class="type"><span class="type"><a href="class.mysqli-result.php" class="type mysqli_result">mysqli_result</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">手続き型</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>mysqli_store_result</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.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code><span class="initializer"> = 0</span></span>): <span class="type"><span class="type"><a href="class.mysqli-result.php" class="type mysqli_result">mysqli_result</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><a href="mysqli-result.data-seek.php" class="function">mysqli_data_seek()</a></span> で使用される、
   <code class="parameter">mysql</code> で表されたデータベース接続の直近のクエリ
   から結果セットを転送します。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mysqli.store-result-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
   <dt><code class="parameter">link</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">mode</code></dt>
     <dd>
      <p class="para">
       指定したいオプション。
       PHP 8.1 以降では、このパラメータを指定しても意味はありません。
       以下のいずれかの値を指定します。
       <table id="mysqli.store-result.parameters" class="doctable table">
        <caption><strong>有効なオプション</strong></caption>
        
         <thead>
          <tr>
           <th>名前</th>
           <th>説明</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><strong><code>MYSQLI_STORE_RESULT_COPY_DATA</code></strong></td>
           <td>
           結果を、内部の mysqlnd バッファーから PHP の変数にコピーします。
           デフォルトでは、mysqlnd は参照を利用しており、メモリ内の結果をコピーしたり複製したりしないようにしています。
           ある種の結果セット (短めの行を大量に保持する結果セットなど) の場合は、
           コピーしたほうが、全体的なメモリ使用量を抑えることができます。
           結果を保持する PHP の変数のほうが、解放されるのが早いからです。
           これは mysqlnd でのみ利用可能です。</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mysqli.store-result-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   バッファに格納した結果オブジェクトを返します。エラー時には <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    <span class="function"><strong>mysqli_store_result()</strong></span> は、クエリが結果セットを
    返さなかった場合（例えば、クエリが INSERT 文であった場合）に
    <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。また、結果セットの読み込みに失敗した場合にも
    <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。エラーが発生したかどうかを調べるには、
    <span class="function"><a href="mysqli.error.php" class="function">mysqli_error()</a></span> が空文字列以外を返す・
    <span class="function"><a href="mysqli.errno.php" class="function">mysqli_errno()</a></span> がゼロ以外の値を返す・あるいは
    <span class="function"><a href="mysqli.field-count.php" class="function">mysqli_field_count()</a></span> がゼロ以外の値を返す
    のいずれかを確認します。それ以外にこの関数が <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返す理由としては
    <span class="function"><a href="mysqli.query.php" class="function">mysqli_query()</a></span> のコールに成功して返された
    結果セットが大きすぎる（メモリに割り当てられない）場合がありえます。
    もし <span class="function"><a href="mysqli.field-count.php" class="function">mysqli_field_count()</a></span> がゼロ以外の値を
    返した場合、文は空でない結果セットを生成しています。
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 errors" id="refsect1-mysqli.store-result-errors">
  <h3 class="title">エラー / 例外</h3>
  <p class="para">
mysqli のエラー報告 (<strong><code><a href="mysqli.constants.php#constant.mysqli-report-error">MYSQLI_REPORT_ERROR</a></code></strong>) が有効になっており、かつ要求された操作が失敗した場合は、警告が発生します。さらに、エラー報告のモードが <strong><code><a href="mysqli.constants.php#constant.mysqli-report-strict">MYSQLI_REPORT_STRICT</a></code></strong> に設定されていた場合は、<span class="classname"><a href="class.mysqli-sql-exception.php" class="classname">mysqli_sql_exception</a></span> が代わりにスローされます。</p>
 </div>


 <div class="refsect1 changelog" id="refsect1-mysqli.store-result-changelog">
  <h3 class="title">変更履歴</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>バージョン</th>
      <th>説明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.4.0</td>
      <td>
       <code class="parameter">mode</code> パラメータの指定は非推奨となりました。
       PHP 8.1 以降では、このパラメータを指定しても意味はありません。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-mysqli.store-result-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <span class="function"><a href="mysqli.multi-query.php" class="function">mysqli_multi_query()</a></span> を参照ください。
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-mysqli.store-result-notes">
  <h3 class="title">注意</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    クエリ結果が使用するメモリを <span class="function"><a href="mysqli-result.free.php" class="function">mysqli_free_result()</a></span>
    関数で開放するのは、どんな場合でも大切です。しかし、大きい結果セットを
    <span class="function"><strong>mysqli_store_result()</strong></span> で転送した際は、特にこれが
    重要となります。
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-mysqli.store-result-seealso">
  <h3 class="title">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="mysqli.real-query.php" class="function" rel="rdfs-seeAlso">mysqli_real_query()</a> - SQL クエリを実行する</span></li>
    <li><span class="function"><a href="mysqli.use-result.php" class="function" rel="rdfs-seeAlso">mysqli_use_result()</a> - 結果セットの取得を開始する</span></li>
   </ul>
  </p>
 </div>


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