Site icon Hip-Hop Website Design and Development

MySQL variable in question

I’ve received tenant portal once I want to point out operating steadiness for every transaction.
Here is question I’ve written which does what I want it to do.

Downside I’ve received is that it does not work in WordPress. Here is my code:

if (is_user_logged_in()) {
$person = wp_get_current_user();
$steadiness = $wpdb->question( 
$wpdb->put together( 
    set @csum := "SELECT current_balance FROM exp_ten WHERE tenant_number =  . (int) $user->ID";
    choose tenant_number, transaction_amount, (@csum := @csum + transaction_amount) as narrative
    from exp_tran
    order by tenant_number;
    )

);

and right here is the error I get:

Parse error: syntax error, surprising ‘@’, anticipating ‘,’ or ‘)’ in /house/path-to-the-file.php on line 165

Might anybody please assist how one can change question so it might be accepted by WordPress. If I am proper drawback is that WordPress does not settle for mysql variable @csum.

Thanks upfront fro your assist.