[thelist] Inserting dates and booleans into MS Access

Tim Burgan email at timburgan.com
Wed Jan 19 06:54:05 CST 2005


Hello Michele,


Michele Foster (WizarDev) wrote:

> For the booleans, remove the quotes when inserting into the database.
>
> Same problem with the date, but I'm not 100% sure on how to do it in PHP.
> In ASP, I surround the date value with # # instead of the quotes.
>
> In your sample above, is that the result of using the mkdate function, or
> just random numbers?


Thanks for your reply. I still can't get it going.

The mkdate() function converts my date in the format of '20 Jan 2005' to 
1106061805, which I believe DOES mean something, because when I 
read/get/pull a date from the Access database and display it on the 
screen as is.. it is shown in this meaningless format. You use the 
strfdate() function to format it to a meaningful string . For your 
interest, here's how the mkdate function works:
   mktime(01,20,2005); // returns 1106061805


If I just use hash cards (#) instead of quotes, I get this syntax error:
*Warning*: (null)(): Invoke() failed: Exception occurred. *Source*: 
Microsoft OLE DB Provider for ODBC Drivers *Description*: 
[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query 
expression '#1106061805#'. in *C:\path\to\myfile.php* on line *204*


Thanks for your time.

Tim








More information about the thelist mailing list