MySQL Forums
Forum List  »  PHP

Can't display MYSQL data
Posted by: Gordon White
Date: November 20, 2015 07:36AM

I can't figure this ou.
It does the "TRUNCATE", and "INSERT" perfectly, just no output on web page.
I get the headers correctly also.

<?php
include 'config.php';


$sql = "TRUNCATE TABLE `data1`";
$result = $conn->query($sql);

$sql1 = "INSERT INTO `data1`(`Entry`, `Name`, `Points`, `Winnings`, `HH`, `Fty`, `Attend`)
SELECT a.playersid as Entry, b.name as Name, sum(a.points) as Points, sum(a.payout) as Winnings, sum(a.high_hand) as HH, sum(a.fifty_fifty) as Fty, sum(a.attend) as Attend FROM data a, players b where a.playersid = b.playersid group by Entry";
$result1 = $conn->query($sql1);

echo "<table border='0' colspace='3'><tr><th>Entry</th><th>Name</th><th>Points</th><th>Winnings</th><th>High Hand</th><th>Fifty Fifty</th><th>Wks Pld</th></tr>";
// output data of each row

if ($result1->num_rows > 0) {
// output data of each row
while($row = $result1->fetch_assoc()) {
echo "<tr><td align='center'>". $row["Entry"]."</td>";
echo "<td align='left'>". $row["Name"]."</td>";
echo "<td align='center'>". $row["Points"]."</td>";
echo "<td align='center'>". $row["Winnings"]."</td>";
echo "<td align='center'>". $row["HH"]."</td>";
echo "<td align='center'>". $row["Fty"]."</td></tr>";
echo "<td align='center'>". $row["Attend"]."</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>

Options: ReplyQuote


Subject
Written By
Posted
Can't display MYSQL data
November 20, 2015 07:36AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.