downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | 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 Git repository for this website on git.php.net.

Source of: /manual/en/function.sqlsrv-server-info.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.sqlsrv.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.sqlsrv-server-info.php',
   
1 => 'sqlsrv_server_info',
  ),
 
'up' =>
  array (
   
0 => 'ref.sqlsrv.php',
   
1 => 'SQLSRV Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.sqlsrv-send-stream-data.php',
   
1 => 'sqlsrv_send_stream_data',
  ),
 
'next' =>
  array (
   
0 => 'book.sybase.php',
   
1 => 'Sybase',
  ),
 
'alternatives' =>
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.sqlsrv-server-info" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sqlsrv_server_info</h1>
  <p class="verinfo">(No version information available, might only be in SVN)</p><p class="refpurpose"><span class="refname">sqlsrv_server_info</span> &mdash; <span class="dc-title">Returns information about the server</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.sqlsrv-server-info-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><strong>sqlsrv_server_info</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$conn</code></span>
   )</div>

  <p class="para rdfs-comment">
   Returns information about the server.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.sqlsrv-server-info-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">conn</code></em></span>
     <dd>

      <p class="para">
       The connection resource that connects the client and the server.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sqlsrv-server-info-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an array as described in the following table:
  <table class="doctable table">
  <caption><strong>Returned Array</strong></caption>
  
    <thead>
     <tr>
      <th>CurrentDatabase</th>
      <th>The connected-to database.</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>SQLServerVersion</td>
      <td>The SQL Server version.</td>
     </tr>

     <tr>
      <td>SQLServerName</td>
      <td>The name of the server.</td>
     </tr>

    </tbody>
  
  </table>
 
</p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.sqlsrv-server-info-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-2232">
    <p><strong>Example #1  <span class="function"><strong>sqlsrv_server_info()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$serverName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"serverName\sqlexpress"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlsrv_connect</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$serverName</span><span style="color: #007700">);<br />if(&nbsp;</span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">false&nbsp;</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die(&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">sqlsrv_errors</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">));<br />}<br /><br /></span><span style="color: #0000BB">$server_info&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlsrv_server_info</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br />if(&nbsp;</span><span style="color: #0000BB">$server_info&nbsp;</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach(&nbsp;</span><span style="color: #0000BB">$server_info&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$key&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$value</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$key</span><span style="color: #007700">.</span><span style="color: #DD0000">":&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$value</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die(&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">sqlsrv_errors</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">));<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

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

 
 <div class="refsect1 seealso" id="refsect1-function.sqlsrv-server-info-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.sqlsrv-client-info.php" class="function" rel="rdfs-seeAlso">sqlsrv_client_info()</a> - Returns information about the client and specified connection</span></li>
   </ul>
  </p>
 </div>

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