[Tool/Web/Other] PHP/CSS/SQL/: Server Logging Display Table
#1

Hello, I'm here to introduce a simple PHP/CSS/SQL script that will allow you to display your Servers MYSQL tables on your website. This script can display any SQL table information, whether it's your Servers Command Logs, or just anything that uses MYSQL Tables. You may use this on your website as a .php file, or a custom forum page. I manually edited this table with CSS.

- Note: Your Gamemode would need to run on MYSQL database for this to work on it.

Example of how the code can be modified:



Optional: You can remove the border-width:1px; and the border-color:grey or change the colors to suit your needs.

PHP Code:
<?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'll try my best to provide support here when possible.
Reply
#2

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!
Reply
#3

Quote:
Originally Posted by whadez
View Post
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!
Sorry but, this is actually a pretty useful script for displaying MYSQL tables on a website as simple as it is.

It's a topic that some people could find of use, but thank you for your disturbing criticism.
Reply
#4

Quote:
Originally Posted by whadez
View Post
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!
Seriously?

This is really useful. Get off your high horse.
Reply
#5

Quote:
Originally Posted by SchurmanCQC
View Post
Seriously?

This is really useful. Get off your high horse.
I really appreciate this, thank you. It's nice of you to reply!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)