stored procedure in MYsql access in PHP
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);
}
精彩评论