Right, SQL is a syntax, not a programming language, so you can't use IF statements.
"SELECT count(attendence) as total_attendence FROM employee INNER JOIN attendence ON employee.emp_id = attendence.employee_id AND MONTH(date)=MONTH(CURDATE())' , '') ";
What are you trying to accomplish here?
if($data , 'where $this->action='$this->value'
Using an IF Statement in a MySQL SELECT query
The IF/THEN/ELSE construct you are using is only valid in stored procedures and functions. Your query will need to be restructured because you can't use the IF() function to control the flow of the WHERE clause like this.
The IF() function that can be used in queries is primarily meant to be used in the SELECT portion of the query for selecting different data based on certain conditions, not so much to be used in the WHERE portion of the query:
SELECT IF(JQ.COURSE_ID=0, 'Some Result If True', 'Some Result If False'), OTHER_COLUMNS
FROM ...
WHERE ...