链接失败!Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 ) [1] => Array ( [0] => IM002 [SQLSTATE] => IM002 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序 [message] => [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序 ) )
www.goxzjj.com/phpTest/phpinfo.htm
http://go.microsoft.com/fwlink/?LinkId=163712
找你对应的版本
$connstr="Driver={Sql Server};Server=127.0.0.1;uid=sa;pwd=;database=dataname";
$conn->Open($connstr);
我通过这样连接数据库成功了 但是sqlsrv_query 时出了问题
$conn=new COM("ADODB.Connection");$connstr="Driver={Sql Server};Server=.;uid=sa;pwd=;database=EducationDB";$conn->open($connstr);$sql="select * from Navigation";$rs=$conn->Execute($sql);$row="0";while(!$rs->EOF){
$string ="";
for ($i=0;$i<$rs->Fields->count;$i++){ if ($i==0) {$string.=$rs->Fields($i)->Value;continue; } $string.='|'.$rs->Fields($i)->Value;}$string.="\n";if ($row==300){ break;}$row++; echo "<br>";
echo $string;
$rs->MoveNext();}?>