如何在mssql和php中执行存储过程后显示输出

时间:2011-09-25 19:41:23

标签: php sql-server stored-procedures

$server = 'x.x.x.x\SQLEXPRESS';

// Connect to MSSQL
$link = mssql_connect($server, 'username', 'password');

if (!$link) {

    die('Something went wrong while connecting to MSSQL');
}
else
{
    echo "Connected!";``
}

$selected = mssql_select_db('dbname', $link)
    or die("Couldn't open database ")

$proc = mssql_init('sp_Index', $link);
$proc_result = mssql_execute($proc);

如何显示$ proc_result的结果。我的存储过程是sp_index。我不知道结构sp_index

1 个答案:

答案 0 :(得分:0)

mssql_fetch_array()怎么办?

while ($row = mssql_fetch_array($proc_result)
{
    // Do your thing with $proc['column_name']
}