Re: Inserting current date(MySQL)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@mustardandrelish.com> wrote in message
3DC0256F.3000306@mustardandrelish.com">news:3DC0256F.3000306@mustardandrelish.com...
> 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux