Perl 调用 MySQL 存储过程并获得返回值

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

$stmt=$my_db->prepare("SELECT isodd(?)") or die($my_db->error);

$stmt->bind_param('i',$aNumber) or die($stmt->error);

$stmt->execute() or die($stmt->error);

$stmt->bind_result($isodd);

$stmt->fetch();

if ($isodd == 1 )
   printf("%d is an odd number\n",$aNumber);
else
   printf("%d is an even number\n",$aNumber);