MySQL (I assume that's the database you're inserting into) requires dates to
be sent in YYYY-MM-DD format. You appear to be sending a unix timestamp.

Try:

date("Y-m-d",time()) // Sends a MySQL style date.

or even:

$SQL = "INSERT INTO orders (Customer_Id, Order_Date) VALUES($CustID,NOW())";
// uses MySQL's builtin date function to store the current date.

HTH,

Danny.

----- Original Message -----
From: "Alia Mikati" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 10:28 AM
Subject: [PHP] Date function


> Hello
> I have the following SQL and I wanna insert the current date in one of
> the table fields but it's not working. Can u tell me whats the problem?
> (I'm using mysql and php)
> Thx a lot
>
> $SQL = "INSERT INTO orders (Customer_Id, Order_Date)".
>                          "VALUES($CustID,date())";
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to