PHP ODBC运行2查询错误

时间:2014-08-23 20:41:36

标签: php sql odbc

我有一个php文件,我使用odbc从MSSQL 2008获取数据。我让一切正常;但是,当我尝试在第一个查询之后运行另一个查询时,我收到此错误:

警告:odbc_exec():SQL错误:[Microsoft] [ODBC SQL Server驱动程序]连接正忙于另一个hstmt的结果,第7行的C:\ wamp \ www \ 3.php中的SQLExecDirect中的SQL状态S1000 < / p>

if ($conn)
{
//there will be no return output for this one just want to run it to refresh the sales data
  $query1="my query code here"; 
  $result=odbc_exec($conn, $query1);

  $query2="my other query code here"; 
  $result=odbc_exec($conn, $query2);

}

1 个答案:

答案 0 :(得分:0)

我在另一个问题中发布此内容,我认为对您有用。

function foo($sql){
   $res = odbc_exec($this->dbconn, $sql);
   if (odbc_error () and $res===false ) {
       throw new Exception odbc_errormsg($this->dbconn));

   }
    return $res;
}