I have a function i have done that gets the invoice_due_date, it could be in either format: 12/06/2015 or could be 06/12/2015 however i am very new to this and a little lost on how i can do what i want to do.
I need to get date (either format) DD/MM/YYYY or MM/DD/YYYY and compare the date to todays date and if its late to show how many invoices are late.
I guess i need to get the date, check date format and then see if its later than todays today and output the number of how many invoices are late.
PHP so far:
function countLateInvoices() {
// Connect to the database
$mysqli = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
// output any connection error
if ($mysqli->connect_error) {
die('Error : ('.$mysqli->connect_errno .') '. $mysqli->connect_error);
}
$query = "SELECT invoice_due_date
FROM `invoices`";
// mysqli select query
$results = $mysqli->query($query);
/* determine number of rows result set */
$row_cnt = $results->num_rows;
echo $row_cnt;
// Frees the memory associated with a result
$results->free();
// close connection
$mysqli->close();
}