开发者

stored procedure in MYsql access in PHP

开发者 https://www.devze.com 2023-02-04 06:49 出处:网络
I am creating stored procedure ,here code : CREATE PROCEDURE `dbnm`.`getlogin` ( IN uid INT, IN upass VARCHAR(45)

I am creating stored procedure ,here code :

CREATE PROCEDURE `dbnm`.`getlogin`
(
  IN uid INT,
  IN upass VARCHAR(45)
)
BEGIN

 if exists(select uphno,pass from user_master where uphno=uid and pass=upass)then
  ***true
  else
  ***false
 end if;
END $$

DELIMITER ;

i wa开发者_StackOverflow中文版nt return value(**true or **false) in stored procedure

from PHP by calling sp PHP code:

$res = $mysqli->query('call getlogin("1","rashmi")');

how to acesss boolean value in PHP from sp? Thanks


I used Google to find this example.


Try

$data = $res->fetch_array(MYSQLI_NUM);
$result = $data[0];


Check out this

PHP + MySql + Stored Procedures, how do I get access an "out" value?

you can use

   $res = $mysqli->query('call getlogin("1","rashmi",@value)');
   $rs = mysql_query( 'SELECT @value' );
   while($row = mysql_fetch_assoc($rs))
   {
    debug($row);
   }
0

精彩评论

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

关注公众号