|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
PEAR::DB connecting to Access via ODBC - problems with dates
I am using the following code to access and query an ms access database.
php Code:
the connection works just fine and in my production code there is plenty of error checking. the problem i have is formatting the dates correctly for inclusion in the query parameter. i have tried just about every combination i can think of and get, variously, empty result sets and errors. MS access seems to want something akin to a number but including the slashes and surrounded by hash signs. ie but of course we can't give this type of data in php as the hash sign is a commment designator. yes i could output a specific ascii character but this seems really backwards. the relevant field type in access is date/time. does anyone have any experience of how to use dates in queries to access databases across odbc using PEAR thanks justin |
|
#2
|
|||
|
|||
|
RE: PEAR::DB connecting to Access via ODBC - problems with dates
to all those who take the time to read, there are two solutions...
solution 1 - replace the ? placeholder (which is for scalars) with the ! for literals. then forget the quirky access date format and use the standard yyyy-mm-dd variant. solution 2 - replace the criteria with a single criterion and set the array parameter to "May". clearly solution 1 is more flexible and is the implementation i was after. The second is quite neat for ease of reference. I suspect that it may not be very efficient in terms of processing time however. thanks Justin |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PEAR Packages > PEAR::DB connecting to Access via ODBC - problems with dates |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|