Home > Backend Development > PHP Tutorial > PHP中,用PDO方式,调用存储过程失败。

PHP中,用PDO方式,调用存储过程失败。

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:52:41
Original
1059 people have browsed it

MYSQL,存储过程

CREATE DEFINER=`trip_admin`@`localhost` PROCEDURE `outtemp`(OUT `p_outtext` VARCHAR(100))proc:BEGIN    set p_outtext='测试';    insert into temp (tp) value (p_outtext);END
Copy after login


表TEMP,就一个tp字段。

PHP,PDO的方式,调用这个存储过程,没有返回值,表里也没有增加数据。
	$DSN = "$DBMS:host=$HOST;dbname=$DBName";	$pdo = new PDO($DSN,$UserName,$PassWord);	$pdo -> query("set names uft8");	$result=$pdo->prepare("call outtemp (?)");	$result->bindParam(1,$result_text,PDO::PARAM_STR,100);	$result->execute();
Copy after login


环境:
windows server 2008 x64
MySQL 5.6.19
PHP 5.5.14 


回复讨论(解决方案)

研究出来怎么回事。也解决带多个IN和OUT参数的存储过程,用PDO怎么调用和取得返回值了。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template