开发者

PDO: Calling mysql stored procedure that creates a temporary table and then selecting from it

开发者 https://www.devze.com 2023-02-05 18:46 出处:网络
This is a simplified version of my query: CALL Create_List( \'company\' ); SELECT name FROM tmpCompany;

This is a simplified version of my query:

CALL Create_List( 'company' ); SELECT name FROM tmpCompany;

Create_List creates a temporary table tmpCompany.

These two statements work correctly when run directly into the database using phpmyadmin but when i call it using PDO in php, I don't get a result.

Is there a specific way of calling stored procedures from php?

PHP Code

$result = $this->db->prepare( "CALL Create_List( :table ); SELECT name FROM tmpCompany;" );
$result->bindParam( ':table', $this->table );
$resu开发者_运维知识库lt->execute();     
return $result->fetch();

EDIT

Possibly related?

http://bugs.php.net/bug.php?id=38001


Try breaking the CALL and SELECT into separate statements.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号