The query I am running returns 2 results when run from PhpMyAdmin but returns nothing when run from a PHP script:
SELECT event_contacts.*, tasks.all_forms_in, tasks.drive_folder_empty FROM event_contacts, tasks WHERE event_contacts.eid = tasks.eid AND tasks.all_forms_in = 'y' AND tasks.drive_folder_empty = 'completed' AND event_contacts.email_sent_date IS NULL
My PHP code is as follows:
$query = mysql_query("SELECT event_contacts.*, tasks.all_forms_in, tasks.drive_folder_empty FROM event_contacts, tasks WHERE event_contacts.eid = tasks.eid AND tasks.all_forms_in = 'y' AND tasks.drive_folder_empty = 'completed' AND event_contacts.email_sent_date IS NULL");
$result = mysql_query($query) or die($query."<br/><br/>".mysql_error());
while ($row = mysql_fetch_array($query)){
// do stuff
}
}
Why does it return 2 rows when run from PhpMyAdmin, but dies with "Query was empty" when run from the PHP script?