MSSQL函数给出mssql_query():查询失败

时间:2014-12-03 10:47:54

标签: php sql-server stored-procedures

我有以下PHP代码段正在检索记录:

    $thecall = "EXEC Web.spSearch @Keyword = \"$search\", @Publication = $publication";

    $search_results = mssql_query( $thecall); 
    if( $search_results === false ) { die( print_r( mssql_get_last_message(), true)); }

    $search_total = mssql_query( $thecall); 
    if( $search_total === false ) { die( print_r( mssql_get_last_message(), true)); }

    do {
        $counter=0;
        while ($obj=mssql_fetch_object($search_total)) 
        {
            $total++;
        }
    } while (mssql_next_result($search_total));

运行时,它会给出:

Error : mssql_query(): Query failed

当我评论这一行时:

$search_total = mssql_query( $thecall);

错误不再出现了,而是出现了以下内容:"错误:mssql_fetch_object()期望参数1为资源,null为" - 正如预期的那样,$ search_total不再被定义。

有人可以帮助指出这个代码段的问题吗?

0 个答案:

没有答案