SQL Server Driver for PHP 1.1

1.1 PHP for Driver Server SQL

Downloads

 MSDN download site

 

Installieren bzw. entpacken und die dll: php_sqlsrv_53_nts_vc9.dll

in C:\php\ext kopieren

 

In der php.ini folgenden eintrag hinzufügen:

extension = php_sqlsrv_53_nts_vc9.dll

 

<?php
$connectionInfo = array("Database"=>"DatabaseName");
$conn = sqlsrv_connect("(local)", $connectionInfo);
if( $conn === false )
{
    echo "Could not connect.<br>";
    die( print_r( sqlsrv_errors(), true));
}
$tsql = "SELECT * FROM Tabelle WHERE Nav = 'sp'";
echo "<h1>Connecting to Tabelle on local SQL Server 2008</h1>";
$stmt = sqlsrv_query( $conn, $tsql);
if ( $stmt )
    echo "Statement executed.<br><br>";
else
{
    echo "Error in statement execution.<br>";
    die( print_r( sqlsrv_errors(), true));
}
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC))
{
    echo "bfdb: ".$row[0]."<br>";
    echo "bfdbd: ".$row[1]."<br>";
}
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?>



Comments are closed