info.php

<?php

  			$conn = mysql_connect("localhost", "root", "password");

			if (!$conn) {
			    echo "Unable to connect to DB: " . mysql_error();
  				exit;
			}

			if (!mysql_select_db("legendarymessages")) {
			    echo "Unable to select mydbname: " . mysql_error();
			    exit;
			}
?><head>
<style>
tr:nth-child(even) {background: #FFF}
tr:nth-child(odd) {background: #EBEBEB}
table{
	border-collapse: collapse;
	border-spacing: 0;
	border: 1px solid black;	
}
.left {
	float: left;
	width: 25%;
}
.middle {
	float: left;
	width: 50%;
}
.right {
	float: right;
	width: 25%;
	text-align: right;
}
</style>
</head>

<p><br />
</p>
<div class="left">
  <table width="90%" border="0" cellspacing="5" cellpadding="5">
    <tr>
      <th width="37%" >Total Players</th>
      <td width="63%" bgcolor="#FFFFFF">
      <?php
      $total = mysql_query("SELECT total_players from information WHERE id = 1");
	  
	  echo mysql_result($total, 0);  
	  ?>
      </td>
    </tr>
  </table>
  <br />
</div>
<div class="middle">
  <table width="100%" border="0" align="center" cellpadding="5" cellspacing="5">
    <tr>
    <th align="left">Username</th>
    <th align="left">Date Joined</th>
    <th align="left">Time Joined</th>
    <th align="left">Player Number</th>
  </tr>
  <?php			
			$sql = "SELECT * FROM players";
			
			
			$result = mysql_query($sql);

			if (!$result) {
  			  echo "Could not successfully run query ($sql) from DB: " . mysql_error();
  			  exit;
			}
            
            while ($row = mysql_fetch_assoc($result)) {
				echo "<tr>";
				echo "<td>".$row['username']."</td>";
				echo "<td>".$row['date']."</td>";
				echo "<td>".$row['time']."</td>";
				echo "<td>".$row['player_number']."</td>";
				echo "</tr>";
				
			}
  
  ?>
</table>
  <br />
</div>
<div class="right">
  <table width="90%" border="0" align="right" cellpadding="5" cellspacing="5">
    <tr>
      <th width="41%" scope="row">Newest Player</th>
      <td width="59%" bgcolor="#FFFFFF">
      <?php
      $player = mysql_query("SELECT newest_player from information WHERE id = 1");
	  
	  echo mysql_result($player, 0);  
	  ?>
      </td>
    </tr>
  </table>
</div>

Comments

Posts Quoted:
Reply
Clear All Quotes