Advertisement
Guest User

Untitled

a guest
May 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <?php
  2.  
  3. // DB table to use
  4. $table = 'players';
  5.  
  6. // Table's primary key
  7. $primaryKey = 'ID';
  8.  
  9. $columns = array(
  10.     array( 'db' => 'ID', 'dt' => 0 ),
  11.     array(
  12.         'db' => 'uid',
  13.         'dt' => 1,
  14.         'formatter' => function( $d, $row ) {
  15.             $uidLink = '<a target="_blank" href="www.steamcommunity.com/profiles/'.$row['1'].'">'.$row['1'].'</a>';
  16.  
  17.             return $uidLink;
  18.         }
  19.     ),
  20.     array(
  21.         'db' => 'name',
  22.         'dt' => 2,
  23.         'formatter' => function( $d, $row ) {
  24.             $nameLink = '<a href=player-details.php?id='.$row[0].'>'.$row[2].'</a>';
  25.  
  26.             return $nameLink;
  27.         }
  28.     ),
  29.     array( 'db' => 'cash',     'dt' => 3 ),
  30.     array( 'db' => 'bank',     'dt' => 4 ),
  31.     array( 'db' => 'faction',     'dt' => 5 )
  32. );
  33.  
  34. // SQL server connection information
  35. $sql_details = array(
  36.     'user' => '',
  37.     'pass' => '',
  38.     'db'   => '',
  39.     'host' => ''
  40. );
  41.  
  42.  
  43. require('ssp.class.php');
  44.  
  45. echo json_encode(
  46.     SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
  47. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement