Okay, I'm going to bring this here as I've worn out the trifocals looking at this thing. I've attached the whole file but, I'll address two areas of YOUR_ADMIN/stats_monthly_sales.php here for brevity.
As previously stated and verified, the code at lines 126 thru 138 incorrectly identify o.delivery_state in that this causes the code to look in the wrong table when accessing mysql.
Code:
//Zone Only SQL appendage $zone_only_sql = '';
$zone_selected = false;
if ($_POST['zone_only'] != '' && !in_array('all', $_POST['zone_only'])) {
$get_zone_only = $_POST['zone_only'];
$zone_selected = true;
$zoned_sql = '';
foreach ($get_zone_only as $selectedZone) {
$zoned_sql .= "o.delivery_state LIKE '" . $selectedZone . "' OR ";
}
$zoned_sql = rtrim($zoned_sql, "OR ");
$zone_only_sql = " AND (" . $zoned_sql . ") ";
}
The $zone_only_sql is used on lines 164, 292, 476, 560, 572, 583, 593, 605, and 617 to formulate different presentations.
Apparently, most of those occurrences work just fine. It's only when selecting a particular state, city, or country that the unfound delivery_state breaks the operation.
I know what information I need (delivery_state) and I know which table it needs to come from (orders) but I can't figure out how to change "o.delivery_state LIKE '" to get the info from the correct table.
Here's an opportunity to teach me to fish beyond just baiting the hook and throwing it in the water.
THANX for any assistance.
PS for anyone wanting to go the extra mile, it would be nice to sort by country as well