cheshirefire
asked on
find results between 2 UK MySQL dates
Hi,
I hope someone can help my headache. Im trying to display all records from a MySQL database which come between 2 dates. Users can enter 2 sets of dates in a PHP form which then pieces together a 'from' date and a 'to' date in the format 30/01/2008.
Ive tried running the following code for the sql query but I either get a page of errors or nothing at all when I know there are records which match.
The date is stored as text in the format 30/01/2009 etc but still no joy.
SELECT costs.cost_invoice_date, costs.cost_job_id, costs.cost_amount_received , costs.cost_payment_method, jobs.job_description FROM costs, jobs WHERE costs.cost_job_id = $n
AND costs.cost_amount_received != ''
AND costs.cost_job_id = jobs.job_id
AND costs.cost_invoice_date >= date_format('$from','dd/mm /yyyy')
ORDER BY costs.cost_invoice_date ASC";
Can anyone help?
I hope someone can help my headache. Im trying to display all records from a MySQL database which come between 2 dates. Users can enter 2 sets of dates in a PHP form which then pieces together a 'from' date and a 'to' date in the format 30/01/2008.
Ive tried running the following code for the sql query but I either get a page of errors or nothing at all when I know there are records which match.
The date is stored as text in the format 30/01/2009 etc but still no joy.
SELECT costs.cost_invoice_date, costs.cost_job_id, costs.cost_amount_received
AND costs.cost_amount_received
AND costs.cost_job_id = jobs.job_id
AND costs.cost_invoice_date >= date_format('$from','dd/mm
ORDER BY costs.cost_invoice_date ASC";
Can anyone help?
SELECT costs.cost_invoice_date, costs.cost_job_id, costs.cost_amount_received, costs.cost_payment_method, jobs.job_description FROM costs, jobs WHERE costs.cost_job_id = $n
AND costs.cost_amount_received != ''
AND costs.cost_job_id = jobs.job_id
AND costs.cost_invoice_date >= date_format('$from','dd/mm/yyyy')
ORDER BY costs.cost_invoice_date ASC";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.