PHP 连接MSSQL2008问题请教
<?php
/* Connect to the local server using Windows Authentication and
specify the AdventureWorks database as the database in use. */
$serverName = "192.168.104.124";
$connectionInfo = array("UID"=>"sa", "PWD"=>"0", "Database"=>"southeast");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
{
echo "Could not connect.\n";
die( print_r( sqlsrv_errors(), true));
}
/* Set up and execute the query. */
$tsql = "select * from Vender";
$stmt = sqlsrv_query( $conn, $tsql, array());
if( $stmt === false)
{
echo "Error in query preparation/execution.\n";
die( print_r( sqlsrv_errors(), true));
}
/* Retrieve each row as an associative array and display the results.*/
$i =0;
while( $row = sqlsrv_fetch_array( $stmt))
{
echo $row['ID'].", ".$row['CompanyName']."<br>";
$i++;
}
echo $i;
/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?> 为什么以上只会输出一条,不会循环输出。
您好,联系一下定制开发部门具体的咨询一下:http://www.tongda2000.com/service/dev_ser.php 电话:010-53617864QQ:2517609862。
页:
[1]