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 >= 1.1.1)</p><p class="refpurpose"><span class="refname">mssql_fetch_row</span> — <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"><?php<br /></span><span style="color: #FF8000">// Connect to server and database<br /></span><span style="color: #0000BB">$link </span><span style="color: #007700">= </span><span style="color: #0000BB">mssql_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'MANGO\SQLEXPRESS'</span><span style="color: #007700">, </span><span style="color: #DD0000">'sa'</span><span style="color: #007700">, </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">, </span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Query to execute<br /></span><span style="color: #0000BB">$query </span><span style="color: #007700">= </span><span style="color: #0000BB">mssql_query</span><span style="color: #007700">(</span><span style="color: #DD0000">'SELECT [id], [quote] FROM [quotes] WHERE [id] = \'42\''</span><span style="color: #007700">, </span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Did the query failed?<br /></span><span style="color: #007700">if(!</span><span style="color: #0000BB">$query</span><span style="color: #007700">)<br />{<br /> die(</span><span style="color: #DD0000">'MSSQL error: ' </span><span style="color: #007700">. </span><span style="color: #0000BB">mssql_get_last_message</span><span style="color: #007700">());<br />}<br /><br /></span><span style="color: #FF8000">// Fetch the row<br /></span><span style="color: #0000BB">$row </span><span style="color: #007700">= </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">// Print the 'quote'<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">'Quote #' </span><span style="color: #007700">. </span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">] . </span><span style="color: #DD0000">': "' </span><span style="color: #007700">. </span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">] . </span><span style="color: #DD0000">'"'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></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: "The answer to everything..."
</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(); ?>