我有一个这样的存储过程:
DELIMITER //
DROP PROCEDURE IF EXISTS `get_games_menu` //
CREATE PROCEDURE `get_games_menu`
(
IN currplayer INT,
OUT gameid INT,
OUT lastdraw INT,
OUT playertiles TEXT,
OUT oppnation INT,
OUT oppname VARCHAR(100),
OUT fdraw INT,
OUT playerpoints INT,
OUT infopop INT,
OUT oppTiles TEXT,
OUT tabletiles TEXT,
OUT playerturn INT,
OUT newtabletiles TEXT,
OUT profileimg VARCHAR(255)
)
BEGIN
SELECT
gp.fk_game_id
, gp.player_tiles
, gp.infoPop
, gp.first_draw
, gp.player_points
, g.table_tiles
, g.new_tiles
, gp2.last_draw_type
, gp2.player_turn
, gp2.player_tiles
, u.country
, u.username
, u.profileimg
INTO
gameid
, playertiles
, infopop
, fdraw
, playerpoints
, tabletiles
, newtabletiles
, lastdraw
, playerturn
, oppTiles
, oppnation
, oppname
, profileimg
FROM nf_gameplayer gp
INNER JOIN nf_games g
ON gp.fk_game_id = g.game_id
INNER JOIN nf_gameplayer gp2
ON gp.fk_game_id = gp2.fk_game_id
AND gp.fk_player_id != gp2.fk_player_id
INNER JOIN nf_users u
ON gp2.fk_player_id = u.id
WHERE gp.fk_player_id = currplayer
AND g.invite=0
AND g.deleteby != currplayer
ORDER BY g.lastdraw;
END //
DELIMITER ;
然后我试图这样称呼它:
$mysqli = new mysqli('localhost', 'root', '', 'mytest');
$rs = $mysqli->query( 'CALL get_games_menu(1, @gameid,@playertiles,@infopop,@fdraw,@playerpoints,@tabletiles,@newtabletiles,@lastdraw,@playerturn,@opptiles,@oppnation,@oppname,@profileimg)' );
$rs = $mysqli->query( 'SELECT @gameid,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL');
while($row = $rs->fetch_object())
{
echo $row['gameid']-'<br>';
}
但我没有得到任何记录。当做一个普通的mysql时,我得到9条记录......
我究竟做错了什么。(新的存储过程)。
提前致谢 ;-)