I want a complex Where with a variable. In its basic version it's something like this :
->where( function ( $q ) {
$q->where( "wp_qspread_invite.parrain", $_SESSION['user_id'], '<>' );
$q->where( 'wp_qspread_invite.invitation', "(SELECT ID FROM wp_qspread_invitation WHERE id_createur = 1)", 'IN', false );
} )
But in place of
WHERE id_createur = 1
I want
WHERE id_createur = $_SESSION['user_id']
I tried different syntaxes without success. What is the correct way to do it? Thx