Calling stored procedure from PHP using PDO to MSSQL Server using INPUT Paramters

前端 未结 1 364
一整个雨季
一整个雨季 2020-12-11 22:08

This does not work:

  $dbh = new PDO(\"dblib:host=xxxx;dbname=xxx\", \"xxxxx\", \"xxxxx\");

  $sth = $dbh->prepare(\"{exec wcweb_UserInfo(?)}\");
  $sth-         


        
相关标签:
1条回答
  • 2020-12-11 22:35

    For some reason this works:

      $sth = $dbh->prepare("exec wcweb_UserInfo ?");
      $sth->bindParam(1, $name);
      $sth->execute();
    
      while($result = $sth->fetch(PDO::FETCH_ASSOC)) {
        var_dump($result);
      }
    

    I might be able to live with this. Anyone know why the other methods do not work? Is it a difference in the libraries?

    0 讨论(0)
提交回复
热议问题