Skip to content

Instantly share code, notes, and snippets.

@heitara
Created April 8, 2014 12:41
Show Gist options
  • Save heitara/10118182 to your computer and use it in GitHub Desktop.
Save heitara/10118182 to your computer and use it in GitHub Desktop.
<?php
// Connects to your Database
mysql_connect("localhost", "user", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$data = mysql_query("select * from table order by created_at desc limit 1, 2000;")
or die(mysql_error());
$row = mysql_fetch_assoc($data);
print '<table><tr>';
foreach($row as $name => $value) {
print "<th>$name</th>";
}
print '</tr>';
while($row) {
print '<tr>';
foreach($row as $value) {
print "<td>$value</td>";
}
print '</tr>';
$row = mysql_fetch_assoc($data);
}
print '</table>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment