title: Connecting to MSSQL database with ADO and PHP
body: <p>I have a MSSQL database. I wrote a php page to connect and retreive data from it. The code works on my localhost.</p>
  
  <pre>
  $strCon = "Provider=SQLOLEDB;Data Source=local;database=test;uid=sa;pwd=go;";
  
  $strAlias = "GEORGE";
  
  $strSql = "SELECT LINK FROM LINKS WHERE ALIAS = '" . $strAlias . "'";
  
  $Con = new COM ("ADODB.Connection") or die("Cannot start ADO");
  $Rs = new COM ("ADODB.Recordset") or die("Cannot start ADO");
  $Con->open($strCon);
  $Rs->open($strSql,$Con,1,3);
  
  if (!$Rs->EOF && !$Rs->BOF) {
   $strTargetLink = $Rs->Fields['LINK'];
   echo $strTargetLink;
  }
  
  $Rs->Close();
  $Con->Close();
  $Rs = null;
  $Con = null;
  </pre>
  
  <p>When I run this code on the server, I receive some error? when echo $strTargetLink; row is executed, word </p>
  
  <blockquote>
    <p>Object</p>
  </blockquote>
  
  <p>is received on the sent html page and also in the source code of that page.</p>
  
  <p>I am running PHP on IIS as a FastCGI application. Both PHP 4.4.7 and 5.2.6 are supported.</p>
  
  <p>Any ideas? What does this <strong>Object</strong> text mean?</p>
  
  <p>Thanks.</p>
  
  <p>Instead of using echo, I now tried</p>
  
  <pre><code>var_dump($strTargetLink);
  </code></pre>
  
  <p>and received the information</p>
  
  <blockquote>
    <p>object(COM)(1) { [0]=> resource(3) of type (COM) }</p>
  </blockquote>