I need to get a left join with a $var! Without variable the code works:
$query->select('d.value AS department');
$query->join('LEFT', '#__jea_departments AS d ON d.id = p.department_id');
I tried all the syntax for entering a variable, but it does not work!
$var="d.test";
$query->select('**$test** AS department');
$query->join('LEFT', '#__jea_departments AS d ON d.id = p.department_id');
I tried "$test" {$test} but it doesn’t work.
You are passing string literals with single quotes, this is the problem. PHP doesn’t interpolate variables within strings defined with single quotes. Change them to double quotes to resolve:
Alternatively concatenate the variables:
From the Manual: