I’ve just spent a couple of hours on what should be a simple query and require some help.
What I am trying to do is calculate the pay of a person between two dates using an Access database and PHP.
Table name: Job
Field names: JOBPAY, STATUS, EMPLOYEEID, DATE
My current query looks like this and is returning a null value even though dates in between this period appear in the database field DATE.
<?php
$db_connection = OpenDB(); //function to connect to database.
$sum= "SELECT SUM(JOBPAY) FROM Job Where STATUS='Closed' and EMPLOYEEID='Jack' and [DATE] BETWEEN 01/10/2008 AND 30/10/2008";
$result = odbc_exec($db_connection,$sum);
odbc_fetch_into($result, $rows);
$open = $rows[0];
odbc_close_all();
When I remove the date related queries I get a result but with the date related queries I get nothing.
Any help would be greatly appreciated.
What I am trying to do is calculate the pay of a person between two dates using an Access database and PHP.
Table name: Job
Field names: JOBPAY, STATUS, EMPLOYEEID, DATE
My current query looks like this and is returning a null value even though dates in between this period appear in the database field DATE.
<?php
$db_connection = OpenDB(); //function to connect to database.
$sum= "SELECT SUM(JOBPAY) FROM Job Where STATUS='Closed' and EMPLOYEEID='Jack' and [DATE] BETWEEN 01/10/2008 AND 30/10/2008";
$result = odbc_exec($db_connection,$sum);
odbc_fetch_into($result, $rows);
$open = $rows[0];
odbc_close_all();
When I remove the date related queries I get a result but with the date related queries I get nothing.
Any help would be greatly appreciated.