date dilemmas

by "Stuart McDonald" <stuart(at)fourelephants.com>

 Date:  Mon, 7 Aug 2000 14:54:40 +0700
 To:  <hwg-techniques(at)hwg.org>
 References:  debbie mscounties
  todo: View Thread, Original
Hi all,

I am using PHP to talk to a Access database and am having problems with
dates.

What I need to do is query an events table within the database and pull out
the events which take plave to a certain day - for example, this could by
today, although it could be next Thursday, or all the dates in between.

Now the problem is I can't get the data to match.

In the example below I am trying just to match for today and I know that
there is a matching value in the db.

I use PHP to get the current date via

$today= (date ("l, d F, Y"));

then I attempt tp match it througha select statement as follows:

$event_query= odbc_exec( $cnx, "SELECT e.Date FROM Event e WHERE
e.Date='#$today'");

but I always get this error message:

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Data type
mismatch in criteria expression., SQL 22005 in SQLExecDirect in ....

Now I asume that this is happening because access formats the date one way
while I am formatting it with PHP in another, but I have tried a number of
varieties with no luck.

Any assistance much appreiciated


Stuart

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA