Why won't these queries work?
$periodfran = "20040401";
$periodtill = "20040501";
$normal = 'SELECT noteusrid, SUM(chargeabletime) AS debitering FROM jobshistory WHERE 1 AND notedtm BETWEEN $periodfran AND $periodtill AND chargeabletime >0 GROUP BY noteusrid';
Returns:
Error: Unknown column '$periodfran' in 'where clause'
And this query:
$periodfran = "20040401";
$periodtill = "20040501";
$normal = 'SELECT noteusrid, SUM(chargeabletime) AS debitering FROM jobshistory WHERE 1 AND notedtm BETWEEN '$periodfran' AND '$periodtill' AND chargeabletime >0 GROUP BY noteusrid';
Returns:
PHP Parse error: parse error, unexpected T_VARIABLE on line xx
Without variables it works fine:
$normal = 'SELECT noteusrid, SUM(chargeabletime) AS debitering FROM jobshistory WHERE 1 AND notedtm BETWEEN "20040401" AND "20040501" AND chargeabletime >0 GROUP BY noteusrid';
Anyone knows why my variables doesn't work? Tried both single and double quotes