$dungeon = 0;
if($stmt->prepare("SELECT id,name FROM `dungeons` WHERE id > ?")) {
$stmt->bind_param('i',$dungeon);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($id,$name);
$stmt2=$stmt;
while($stmt->fetch()) {
echo "<th>".$name."</th>";
$query = "SELECT COUNT(id),AVG(dungeon_percent),MAX(dungeon_percent) FROM `users` WHERE dungeon_current = ?"; $what=$id;
$stmt2->prepare($query);
$stmt2->bind_param('i',$what);
$stmt2->execute();
$stmt2->store_result();
$stmt2->bind_result($howmany,$avg,$max);
$stmt2->fetch();
echo "<td align='center'>".$howmany."</td><td align='center'>".round($avg)."%</td><td align='center'>".$max."%</td></tr>";
}
}
私が持っているものです。それでも、実際には4行あるのに1回だけループしますか? ありがとう。