Source of: /manual/en/function.mssql-execute.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-execute.php',
1 => 'mssql_execute',
),
'up' =>
array (
0 => 'ref.mssql.php',
1 => 'Mssql Functions',
),
'prev' =>
array (
0 => 'function.mssql-data-seek.php',
1 => 'mssql_data_seek',
),
'next' =>
array (
0 => 'function.mssql-fetch-array.php',
1 => 'mssql_fetch_array',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.mssql-execute" class="refentry">
<div class="refnamediv">
<h1 class="refname">mssql_execute</h1>
<p class="verinfo">(PHP 4 >= 4.0.7, PHP 5, PECL odbtp >= 1.1.1)</p><p class="refpurpose"><span class="refname">mssql_execute</span> — <span class="dc-title">Executes a stored procedure on a MS SQL server database</span></p>
</div>
<a name="function.mssql-execute.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type"><a href="language.pseudo-types.php#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><b>mssql_execute</b></span>
( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$stmt</tt></span>
[, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$skip_results</tt><span class="initializer"> = false</span></span>
] )</div>
<p class="para rdfs-comment">
Executes a stored procedure on a MS SQL server database
</p>
</div>
<a name="function.mssql-execute.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">stmt</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Statement handle obtained with <a href="function.mssql-init.php" class="function">mssql_init()</a>.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">skip_results</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Whenever to skip the results or not.
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.mssql-execute.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 <b>mssql_execute()</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">// Create a new statement<br /></span><span style="color: #0000BB">$stmt </span><span style="color: #007700">= </span><span style="color: #0000BB">mssql_init</span><span style="color: #007700">(</span><span style="color: #DD0000">'NewBlogEntry'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Some data strings<br /></span><span style="color: #0000BB">$title </span><span style="color: #007700">= </span><span style="color: #DD0000">'Test of blogging system'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$content </span><span style="color: #007700">= </span><span style="color: #DD0000">'If you can read this, then the new system is compatible with MSSQL'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Bind values<br /></span><span style="color: #0000BB">mssql_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">, </span><span style="color: #DD0000">'@author'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Felipe Pena'</span><span style="color: #007700">, </span><span style="color: #0000BB">SQLVARCHAR</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">, </span><span style="color: #0000BB">60</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">mssql_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">, </span><span style="color: #DD0000">'@date'</span><span style="color: #007700">, </span><span style="color: #DD0000">'08/10/2008'</span><span style="color: #007700">, </span><span style="color: #0000BB">SQLVARCHAR</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">, </span><span style="color: #0000BB">20</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">mssql_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">, </span><span style="color: #DD0000">'@title'</span><span style="color: #007700">, </span><span style="color: #0000BB">$title</span><span style="color: #007700">, </span><span style="color: #0000BB">SQLVARCHAR</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">, </span><span style="color: #0000BB">60</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">mssql_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">, </span><span style="color: #DD0000">'@content'</span><span style="color: #007700">, </span><span style="color: #0000BB">$content</span><span style="color: #007700">, </span><span style="color: #0000BB">SQLTEXT</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Execute the statement<br /></span><span style="color: #0000BB">mssql_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// And we can free it like so:<br /></span><span style="color: #0000BB">mssql_free_statement</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
</div><p>
</p>
</div>
<a name="function.mssql-execute.notes"></a><div class="refsect1 notes">
<h3 class="title">Notes</h3>
<blockquote><p><b class="note">Note</b>:
If the stored procedure returns parameters or a return value these will
be available after the call to <b>mssql_execute()</b> unless
the stored procedure returns more than one result set. In that case
use <a href="function.mssql-next-result.php" class="function">mssql_next_result()</a> to shift through the results.
When the last result has been processed the output parameters and return
values will be available.
<br />
</p></blockquote>
</div>
<a name="function.mssql-execute.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-bind.php" class="function" rel="rdfs-seeAlso">mssql_bind()</a> - Adds a parameter to a stored procedure or a remote stored procedure</li>
<li class="member"><a href="function.mssql-free-statement.php" class="function" rel="rdfs-seeAlso">mssql_free_statement()</a> - Free statement memory</li>
<li class="member"><a href="function.mssql-init.php" class="function" rel="rdfs-seeAlso">mssql_init()</a> - Initializes a stored procedure or a remote stored procedure</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>