Home  >  Article  >  Backend Development  >  mysql - 如何使用php调用sql server的存储过程?

mysql - 如何使用php调用sql server的存储过程?

WBOY
WBOYOriginal
2016-06-06 20:36:221178browse

在yii框架中用php调用sql server的存储过程,怎么操作。比如一个存储过程的方法名字为pc_sms_send,其中带有参数,如a,b,c,d.调用成功返回1,失败返回0.求示例代码

回复内容:

在yii框架中用php调用sql server的存储过程,怎么操作。比如一个存储过程的方法名字为pc_sms_send,其中带有参数,如a,b,c,d.调用成功返回1,失败返回0.求示例代码

<code><?php /* Call a stored procedure with an INOUT parameter */
$colour = 'red';
$sth = $dbh->prepare('CALL puree_fruit(?)');
$sth->bindParam(1, $colour, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 12);
$sth->execute();
print("After pureeing fruit, the colour is: $colour");
?>
</code>

PHPNET

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn