I have this query works on localhost:
$clicks = $wpdb->get_results(
"SELECT *
FROM {$wpdb->prefix}data
WHERE date BETWEEN ( NOW() - INTERVAL {$args['day']} DAY ) AND NOW()
{$where}
ORDER BY {$args['order_by']} {$args['order']}
LIMIT {$args['data_per_page']} OFFSET {$offset}",
ARRAY_A
);
$clicks
returns the expected result array.
My localhost uses XAMPP 1.8.3, it uses PHP 5.5.11 and 5.6.16 (based on this).
When I test it on online server (I use Hostgator with PHP 5.4.45, and MySQL 5.5.42), $click
returns empty array.
There is no syntax error caution or any warning so I am confused.
Is it syntax problem? And what is the best practice to debug MySQL query?