<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.mysqli-result.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'mysqli-result.field-count.php',
    1 => 'mysqli_result::$field_count',
    2 => 'Gets the number of fields in the result set',
  ),
  'up' => 
  array (
    0 => 'class.mysqli-result.php',
    1 => 'mysqli_result',
  ),
  'prev' => 
  array (
    0 => 'mysqli-result.fetch-row.php',
    1 => 'mysqli_result::fetch_row',
  ),
  'next' => 
  array (
    0 => 'mysqli-result.field-seek.php',
    1 => 'mysqli_result::field_seek',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mysqli/mysqli_result/field-count.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysqli-result.field-count" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mysqli_result::$field_count</h1>
  <h1 class="refname">mysqli_num_fields</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mysqli_result::$field_count</span> -- <span class="refname">mysqli_num_fields</span> &mdash; <span class="dc-title">Gets the number of fields in the result set</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mysqli-result.field-count-description">
  <h3 class="title">Descrizione</h3>
  <p class="para">Stile orientato agli oggetti</p>
  <div class="fieldsynopsis"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <var class="varname"><a href="mysqli-result.field-count.php">$mysqli_result-&gt;field_count</a></var>;</div>

  <p class="para">Stile procedurale</p>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mysqli_num_fields</strong></span>(<span class="methodparam"><span class="type"><a href="class.mysqli-result.php" class="type mysqli_result">mysqli_result</a></span> <code class="parameter">$result</code></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   Returns the number of fields in the result set.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mysqli-result.field-count-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    <dt><code class="parameter">
result</code></dt><dd><p class="para">Solo nello stile procedurale: un identificatore
di resultset restituito da <span class="function"><a href="mysqli.query.php" class="function">mysqli_query()</a></span>, <span class="function"><a href="mysqli.store-result.php" class="function">mysqli_store_result()</a></span>
o <span class="function"><a href="mysqli.use-result.php" class="function">mysqli_use_result()</a></span>.</p></dd>
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mysqli-result.field-count-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   An <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> representing the number of fields.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mysqli-result.field-count-examples">
  <h3 class="title">Esempi</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 Stile orientato agli oggetti</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />mysqli_report</span><span style="color: #007700">(</span><span style="color: #0000BB">MYSQLI_REPORT_ERROR </span><span style="color: #007700">| </span><span style="color: #0000BB">MYSQLI_REPORT_STRICT</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$mysqli </span><span style="color: #007700">= new </span><span style="color: #0000BB">mysqli</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">, </span><span style="color: #DD0000">"my_user"</span><span style="color: #007700">, </span><span style="color: #DD0000">"my_password"</span><span style="color: #007700">, </span><span style="color: #DD0000">"world"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">$mysqli</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT Name, CountryCode, District, Population FROM City ORDER BY ID LIMIT 1"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Get the number of fields in the result set */<br /></span><span style="color: #0000BB">$field_cnt </span><span style="color: #007700">= </span><span style="color: #0000BB">$result</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">field_count</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Result set has %d fields.\n"</span><span style="color: #007700">, </span><span style="color: #0000BB">$field_cnt</span><span style="color: #007700">);</span></span></code></div>
   </div>

  </div>
  <div class="example" id="example-2">
   <p><strong>Example #2 Stile procedurale</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />mysqli_report</span><span style="color: #007700">(</span><span style="color: #0000BB">MYSQLI_REPORT_ERROR </span><span style="color: #007700">| </span><span style="color: #0000BB">MYSQLI_REPORT_STRICT</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$link </span><span style="color: #007700">= </span><span style="color: #0000BB">mysqli_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">, </span><span style="color: #DD0000">"my_user"</span><span style="color: #007700">, </span><span style="color: #DD0000">"my_password"</span><span style="color: #007700">, </span><span style="color: #DD0000">"world"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">mysqli_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">, </span><span style="color: #DD0000">"SELECT Name, CountryCode, District, Population FROM City ORDER BY ID LIMIT 1"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Get the number of fields in the result set */<br /></span><span style="color: #0000BB">$field_cnt </span><span style="color: #007700">= </span><span style="color: #0000BB">mysqli_num_fields</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Result set has %d fields.\n"</span><span style="color: #007700">, </span><span style="color: #0000BB">$field_cnt</span><span style="color: #007700">);</span></span></code></div>
   </div>

   <div class="example-contents"><p>I precedenti esempi visualizzeranno:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Result set has 4 fields.</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-mysqli-result.field-count-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="mysqli-result.fetch-field.php" class="function" rel="rdfs-seeAlso">mysqli_fetch_field()</a> - Returns the next field in the result set</span></li>
   </ul>
  </p>
 </div>


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