Skip to content

Instantly share code, notes, and snippets.

@RSquaredSoftware
Created April 18, 2012 05:38
Show Gist options
  • Save RSquaredSoftware/2411307 to your computer and use it in GitHub Desktop.
Save RSquaredSoftware/2411307 to your computer and use it in GitHub Desktop.
foreach ($games as $game) {
try{
$dbh->exec("USE $dbName;");
$sth = $dbh->prepare("SELECT * FROM $game ORDER BY date $sort");
$sth->execute();
$result[$game] = $sth->fetchAll(PDO::FETCH_ASSOC);
}
catch (PDOException $e) {
die("Printing Data Error: ". $e->getMessage());
}
}
echo "<table><tr><th><a name=date href='?date=".$datesort."'>Date</a></th>";
foreach ($result as $game => $results) {
echo "<th><a name=$game>$game</a><tr>\n";
foreach ($results as $temp) {
foreach ($temp as $key => $value) {
echo "<td>";
echo $value;
echo "</td>";
}
echo "</tr>";
}
echo "</th>";
}
echo "</table>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment