I am using PHP on Apache with a MySQL 4.0.5 Database. I have this query
select
date_format(date1_interval,'%m %d %Y'),
camp_name, round(sum(talk_duration)/60,2) talk_minutes
from davox_agent_data_daily
where
date_format(date1_interval, '%m %d %Y')=date_format(current_date - 1, '%m %d %Y')
group by
date_format(date1_interval,'%m %d &Y'), camp_name
order by camp_name
which works in the database but php fails with an invalid syntax near -- '%m -- in the first line. Any ideas.
Is it the single quotes or the % sign. I if remove all the date_format stuff the query works in PHP.