任何人都知道如何计算检索的行数?在这种情况下它应该只有1 - 但我似乎无法使其与预备语句一起使用(使用它仍然很新)
提前感谢您的帮助!
if ($stmt = $db->prepare("SELECT playername FROM player_data
WHERE playername = ?"))
{
$stmt->bind_param("s", $_GET["target"]);
$stmt->execute();
$stmt->bind_result($playername);
$stmt->fetch();
$row_cnt = $stmt->num_rows();
printf("Result set has %s rows.\n", $row_cnt);
$stmt->close();
}
else
{
printf("Error: %s", $mysqli->error);
}