0
私はこのコードを作成しましたが、それを実行すると最初の行だけがテーブルを作成しますが、テーブルには複数の行があります。 。いくつかの助けここMySql:クエリは選択から最初の行のみを返します
<?php
include("conf.php");
$file_name = "testing2";
$table = "TEMP_".$file_name;
$table1 = "TEMP1_".$file_name;
$query = "CREATE TABLE IF NOT EXISTS $table1(Id INT AUTO_INCREMENT PRIMARY KEY)
CHARACTER SET utf8 COLLATE utf8_general_ci
SELECT Team, GamesPlayedHome, GoalsScorredHome, GoalsAcceptedHome, RedCardGotHome, AvarageGoalsScorredHome, AvarageGoalsAcceptedHome, GamesPlayedAway, GoalsScorredAway, GoalsAcceptedAway, RedCardGotAway, AvarageGoalsScorredAway, AvarageGoalsAcceptedAway,
AvarageRedCardGotHome, AvarageRedCardGotAway, AvarageShotsOnTargedHome, AvarageShotsOnTargedAway,
AvarageGoalsScorredHome/avg(AvarageGoalsScorredHome) AS AttackingStrengthHome, AvarageGoalsAcceptedHome/avg(AvarageGoalsAcceptedHome) AS DefensiveStrengthHome,
AvarageGoalsScorredAway/avg(AvarageGoalsScorredAway) AS AttackingStrengthAway, AvarageGoalsAcceptedAway/avg(AvarageGoalsAcceptedAway) AS DefensiveStrengthAway
FROM $table
";
$data= mysqli_query($conn,$query) or die(mysqli_error($conn));
while($row = mysqli_fetch_assoc($data)){
foreach($row as $cname => $cvalue){
print "$cname: $cvalue\t";
}
print "\r\n";
}
?>