<?php
//Step1
$db = mysqli_connect('DATABASE_HOST','DATABASE_USER','DATABASE_PASSWORD','DATABASE_NAME')
or die('Error connecting to MySQL server.');
?>
<?php
//Step2
$query = "SELECT * FROM `TABLE_NAME` ORDER BY `COLUMN_NAME`.`COLUMN_NAME` DESC";
mysqli_query($db, $query) or die('Error querying database.');
//Step3
$result = mysqli_query($db, $query);
$row = mysqli_fetch_array($result);
//Step4
echo "<center><style type=\"text/css\">";
echo ".tg {border-collapse:collapse;border-spacing:0;border-color:#fff;}";
echo ".tg td{font-family:Arial, sans-serif;font-size:14px;padding:17px 10px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:grey;color:#fff;background-color:black;}";
echo ".tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:grey;color:#fff;background-color:black;}";
echo ".tg .tg-baqh{text-align:center;vertical-align:top}";
echo "</center></style>
<table class=\"tg\">";
//Step5 - opening table tag
echo '<th class=\"tg-baqh\"><center>Column_Name1</center></th><th class=\"tg-baqh\"><center>Column_Name2</center></th></th><th class=\"tg-baqh\"><center>Column_Name3</center></th><th class=\"tg-baqh\"><center>Column_Name4</center></th>';
//table headers
while ($row = mysqli_fetch_array($result)) {
// we are running a while loop to print all the rows in a table
echo'<tr>'; // printing table row
//Step6
echo '<td><center>' . $row['Column_Name1'] . '</center></td><td><center>' . $row['Column_Name2'] . '</center></td><td><center>' . $row['Column_Name3'] . '</center></td><td><center>' . $row['Column_Name4'] .'</center></td>';
// we are looping all data to be printed till last row in the table
echo'</tr>'; // closing table row
}
echo '</table>'; //closing table tag
?>
I dont mean to be rude but this is the most useless thing I've ever encountered on this forum.
Hopefully your server wont contain such useless stuffs! |
I dont mean to be rude but this is the most useless thing I've ever encountered on this forum.
Hopefully your server wont contain such useless stuffs! |