The following query will not return any results...
if (empty($from_date)) {
$from_date = 2000-01-01;
}
if (empty($to_date)) {
$to_date = 3000-01-01;
}
if (empty($_POST['supervisor'])) {
$_POST['supervisor'] = "%";
}
$query
->select(array('id', 'job_date', 'emp_name', 'super', 'qty_jobs', 'job_id', 'job_name', 'qty_measure', 'qty_install', 'qty_shop', 'qty_misc'))
->from($db->quoteName('admin_service_reports'))
->where(($db->quoteName('job_date') . ' >= ' . $db->quote($from_date).' AND '.$db->quoteName('job_date') . ' <= ' . $db->quote($to_date)).' AND '.$db->quoteName('emp_name').' LIKE "'.$_POST['employee'].'"')
->order('id DESC');
But if I remove the employee comparison in the where part like...
$query
->select(array('id', 'job_date', 'emp_name', 'super', 'qty_jobs', 'job_id', 'job_name', 'qty_measure', 'qty_install', 'qty_shop', 'qty_misc'))
->from($db->quoteName('admin_service_reports'))
->where(($db->quoteName('job_date') . ' >= ' . $db->quote($from_date).' AND '.$db->quoteName('job_date') . ' <= ' . $db->quote($to_date)).'')
->order('id DESC');
It works fine.
I've tried using parenthesis and dozens of other things and it just will not return any rows. Just wondering if anyone sees anything that I haven't in the past 5 hours. I don't know if this is enough info to troubleshoot even. I'm on the fence as far as scrapping the JDatabase code here and going with standard PHP/MySQL.