Date: 10/30/02
- Next message: David Jackson: "[PHP-DB] Resolved: Inserting current date(MySQL)?"
- Previous message: 1LT John W. Holmes: "Re: [PHP-DB] Inserting current date(MySQL)?"
- In reply to: David Jackson: "[PHP-DB] Inserting current date(MySQL)?"
- Next in thread: David Jackson: "[PHP-DB] Resolved: Inserting current date(MySQL)?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm no expert, but here's what I did in the same situation.
$enterdate = date('Ymd'); --- this gives me the current date.
then when entering the information from the form into my database I just
entered the variable into a field called evdt
When using the date I wanted it in a more user friendly state (also UK
format) I did this:
$query = ' SELECT DATE_FORMAT(eventdate, "%D %M %Y")as evdt FROM notices';
This gives me it in the format "1st December 2002".
"David Jackson" <info <email protected>> wrote in message
news:3DC0256F.3000306 <email protected>
> Howdy --
> I'm my trying to insert to current date from a php form? I know that
> MySQL has a CURDATE() fucntion and PHP has several date function, but I
> cann't seem to get either to work? Here is my existing code:
>
> TIA,
> David Jackson
>
>
> ---------- client_add.php --------
>
> </html>
> <body>
>
> <?php require('connect.php'); ?>
> <?php
> $ADDDATE=date("Y-m-d");
> mysql_query ("INSERT INTO client (cl_add_date,
> cl_first_name,
> cl_last_name,
> cl_company,
> cl_phone,
> cl_email,
> cl_address,
> cl_city,
> cl_state,
> cl_zip,
> cl_web)
>
> VALUES ('$_POST[ADDDATE]',
> '$_POST[cl_first_name]',
> '$_POST[cl_last_name]',
> '$_POST[cl_company]',
> '$_POST[cl_phone]',
> '$_POST[cl_email]',
> '$_POST[cl_address]',
> '$_POST[cl_city]',
> '$_POST[cl_state]',
> '$_POST[cl_zip]',
> '$_POST[cl_web]') ");
> ?>
>
> </body>
> </html>
>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: David Jackson: "[PHP-DB] Resolved: Inserting current date(MySQL)?"
- Previous message: 1LT John W. Holmes: "Re: [PHP-DB] Inserting current date(MySQL)?"
- In reply to: David Jackson: "[PHP-DB] Inserting current date(MySQL)?"
- Next in thread: David Jackson: "[PHP-DB] Resolved: Inserting current date(MySQL)?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

