Advertisement
Guest User

Untitled

a guest
May 27th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. <?php
  2.  
  3. $mysqlserver = localhost;
  4. $mysqluser = sadasdssad;
  5. $mysqlpassword = sdasdsadas;
  6.  
  7.  
  8. $connect = mysql_connect($mysqlserver, $mysqluser, $mysqlpassword);
  9.  
  10. if (!$connect) {
  11.  
  12. die(' A connection could not be established to the MYSQL server: ' . mysql_error());
  13.  
  14. }
  15.  
  16. mysql_select_db("harlexne_admin");
  17.  
  18. $query = mysql_query("SELECT SteamID, Name, Banner, Length, Reason FROM bans");
  19. $result = $query;
  20.  
  21. $fields_num = mysql_num_fields($result);
  22.  
  23. echo "<h1>Currently Banned: </h1>";
  24. echo "<table border='1'><tr>";
  25. // printing table headers
  26. for($i=0; $i<$fields_num; $i++)
  27. {
  28.     $field = mysql_fetch_field($result);
  29.     echo "<td><b>{$field->name}</b></td>";
  30. }
  31. echo "</tr>\n";
  32. // printing table rows
  33. while($row = mysql_fetch_row($result))
  34. {
  35.     echo "<tr>";
  36.  
  37.     // $row is array... foreach( .. ) puts every element
  38.     // of $row to $cell variable
  39.     foreach($row as $cell)
  40.         echo "<td>$cell</td>";
  41.  
  42.     echo "</tr>\n";
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement