我试图弄清楚如何创建准备好的语句。我现在有这个:
$stmt = $mysqli->stmt_init();
if($stmt->prepare("SELECT fk_player_id, player_draws, player_turn, player_passes, swapped FROM ".$prefix."_gameplayer WHERE fk_game_id = ? AND fk_player_id = ?")){
$stmt->bind_param('ii', $currgame, $playerid);
$stmt->execute();
$stmt->bind_result($playerid, $udraws, $uturn, $upass, $uswaps);
$stmt->fetch();
// HERE I WANT TO MAKE A NEW CALL //
$stmt->close();
}
在该区域// 这里我想打一个新电话 //我想运行这个:
$sql = mysql_query("SELECT fk_player_id, player_tiles, player_draws, player_turn, player_passes, swapped FROM ".$prefix."_gameplayer WHERE fk_game_id = $currgame AND fk_player_id != $playerid");
$row = mysql_fetch_assoc($sql);
$opponent = $row['fk_player_id'];
$oppTiles = $row['player_tiles'];
$odraws = $row['player_draws']+1;
$oturn = $row['player_turn'];
$opass = $row['player_passes'];
$oswaps = $row['swapped'];
除了 = 和 != 之外,这两个调用是相同的。这可以在同一个语句中完成吗?
提前致谢 :-)