downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.mssql-fetch-row.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.mssql.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.mssql-fetch-row.php',
   
1 => 'mssql_fetch_row',
  ),
 
'up' =>
  array (
   
0 => 'ref.mssql.php',
   
1 => 'Mssql Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.mssql-fetch-object.php',
   
1 => 'mssql_fetch_object',
  ),
 
'next' =>
  array (
   
0 => 'function.mssql-field-length.php',
   
1 => 'mssql_field_length',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.mssql-fetch-row" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mssql_fetch_row</h1>
  <p class="verinfo">(PHP 4, PHP 5, PECL odbtp &gt;= 1.1.1)</p><p class="refpurpose"><span class="refname">mssql_fetch_row</span> &mdash; <span class="dc-title">Get row as enumerated array</span></p>

 </div>
 
 <a name="function.mssql-fetch-row.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><b>mssql_fetch_row</b></span>
    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$result</tt></span>
   )</div>

  <p class="para rdfs-comment">
   <b>mssql_fetch_row()</b> fetches one row of data from
   the result associated with the specified result identifier.  The
   row is returned as an array.  Each result column is stored in an
   array offset, starting at offset 0.
  </p>
  <p class="para">
   Subsequent call to <b>mssql_fetch_row()</b> would
   return the next row in the result set, or <b><tt class="constant">FALSE</tt></b> if there are no
   more rows.
  </p>
 </div>


 <a name="function.mssql-fetch-row.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">result</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The result resource that is being evaluated. This result comes from a
       call to <a href="function.mssql-query.php" class="function">mssql_query()</a>.
      </p>
     </dd>

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


 <a name="function.mssql-fetch-row.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an array that corresponds to the fetched row, or <b><tt class="constant">FALSE</tt></b> if there
   are no more rows.
  </p>
 </div>


 <a name="function.mssql-fetch-row.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>mssql_fetch_row()</b> example</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Connect&nbsp;to&nbsp;server&nbsp;and&nbsp;database<br /></span><span style="color: #0000BB">$link&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mssql_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'MANGO\SQLEXPRESS'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'sa'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'phpfi'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">mssql_select_db</span><span style="color: #007700">(</span><span style="color: #DD0000">'php'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Query&nbsp;to&nbsp;execute<br /></span><span style="color: #0000BB">$query&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mssql_query</span><span style="color: #007700">(</span><span style="color: #DD0000">'SELECT&nbsp;[id],&nbsp;[quote]&nbsp;FROM&nbsp;[quotes]&nbsp;WHERE&nbsp;[id]&nbsp;=&nbsp;\'42\''</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Did&nbsp;the&nbsp;query&nbsp;failed?<br /></span><span style="color: #007700">if(!</span><span style="color: #0000BB">$query</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;die(</span><span style="color: #DD0000">'MSSQL&nbsp;error:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">mssql_get_last_message</span><span style="color: #007700">());<br />}<br /><br /></span><span style="color: #FF8000">//&nbsp;Fetch&nbsp;the&nbsp;row<br /></span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mssql_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$query</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Print&nbsp;the&nbsp;'quote'<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'Quote&nbsp;#'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">]&nbsp;.&nbsp;</span><span style="color: #DD0000">':&nbsp;"'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">]&nbsp;.&nbsp;</span><span style="color: #DD0000">'"'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents para"><p>The above example will output
something similar to:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Quote #42: &quot;The answer to everything...&quot;
</pre></div>
    </div>
   </div><p>
  </p>
 </div>


 <a name="function.mssql-fetch-row.notes"></a><div class="refsect1 notes">
  <h3 class="title">Notes</h3>
  <blockquote><p><b class="note">Note</b>: <span class="simpara">This function sets NULL fields to
the PHP <b><tt class="constant">NULL</tt></b> value.</span></p></blockquote>
 </div>


 <a name="function.mssql-fetch-row.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.mssql-fetch-array.php" class="function" rel="rdfs-seeAlso">mssql_fetch_array()</a> - Fetch a result row as an associative array, a numeric array, or both</li>
    <li class="member"><a href="function.mssql-fetch-object.php" class="function" rel="rdfs-seeAlso">mssql_fetch_object()</a> - Fetch row as object</li>
    <li class="member"><a href="function.mssql-data-seek.php" class="function" rel="rdfs-seeAlso">mssql_data_seek()</a> - Moves internal row pointer</li>
    <li class="member"><a href="function.mssql-result.php" class="function" rel="rdfs-seeAlso">mssql_result()</a> - Get result data</li>
   </ul><p>
  </p>
 </div>


</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites