<code>$serverName = "192.168.135.211";
$connectionInfo = array(
"Database"=>"AGGCRMTEST", "UID"=>"sa", "PWD"=>"123213");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
{
echo "Could not connect.\n";
die( print_r( sqlsrv_errors(), true));
}
$tsql = "exec [GetListByName] 'o'";
$stmt = sqlsrv_query( $conn, $tsql);
if( $stmt === false )
{
echo "Statement 1 could not be executed.</br>";
die( print_r( sqlsrv_errors(), true));
}else{
$qty = sqlsrv_fetch_array( $stmt);
sqlsrv_free_stmt( $stmt);
}</code>怎样一个一个的取到数据啊。。。。。。。。。。。。。。(让数据一个一个的显示出来)
<code>$serverName = "192.168.135.211";
$connectionInfo = array(
"Database"=>"AGGCRMTEST", "UID"=>"sa", "PWD"=>"123213");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
{
echo "Could not connect.\n";
die( print_r( sqlsrv_errors(), true));
}
$tsql = "exec [GetListByName] 'o'";
$stmt = sqlsrv_query( $conn, $tsql);
if( $stmt === false )
{
echo "Statement 1 could not be executed.</br>";
die( print_r( sqlsrv_errors(), true));
}else{
$qty = sqlsrv_fetch_array( $stmt);
sqlsrv_free_stmt( $stmt);
}</code>怎样一个一个的取到数据啊。。。。。。。。。。。。。。(让数据一个一个的显示出来)
<code>php</code><code>$result = array();
while($qty = sqlsrv_fetch_array( $stmt)){
$result[] = $qty;
}
sqlsrv_free_stmt( $stmt);
</code>
我插一句,建议你用PDO,之前也是用sqlsrv 后来发现有些字符显示不出来而且INPUT/OUTPUT都需要ICONV转换编码,最后换PDO解决了
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号