Server Side Variable Not Passing

Server Side Variable Not Passing

bushellbushell Posts: 1Questions: 1Answers: 0

I'm trying to work with datatables, and it's taken me a long time to get it to work with PHP. Although, it now works - I now want to pass through a variable on the URL it's printing out but I'm having no luck. It's the variable $userName. Is there something I'm missing?

I've tried changing $userName = 'test' and its still no better

// DB table to use
$table = 'promo_offers';

// Table's primary key
$primaryKey = 'id';

// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
session_start();
$userName = $_SESSION['user_id'];
$columns = array(
    array( 'db' => 'brand', 'dt' => 0 ),
     array(
        'db'        => 'min_deposit',
        'dt'        => 1,
        'formatter' => function( $d, $row ) {
            return '£'.number_format($d);
        }
    ),
    array( 'db' => 'category',   'dt' => 2 ),
     array(
        'db'        => 'aff_link',
        'dt'        => 3,
        'formatter' => function( $d, $row ) {
            return '<a href="'.$d.'" target="_blank">Claim'.$userName.'</a>';
        }
    ),
    //array( 'db' => 'aff_link',     'dt' => 3 )
);

// SQL server connection information
$sql_details = array(
    'user' => 'XXXXX',
    'pass' => 'XXXXX',
    'db'   => 'XXXXX',
    'host' => 'localhost'
);


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * If you just want to use the basic configuration for DataTables with PHP
 * server-side, there is no need to edit below this line.
 */


require( 'ssp.class.php' );

echo json_encode(
    SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);

This discussion has been closed.