Re: Inserting current date(MySQL)?

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

 




it looks like you have defined $ADDDATE and it is not a posted variable.
what happens if you just have:
<?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 ('$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>

Jeff


                                                                                                                       
                    David Jackson                                                                                      
                    <info@mustardandr       To:     php-db@lists.php.net                                               
                    elish.com>              cc:                                                                        
                                            Subject:      Inserting current date(MySQL)?                       
                    10/30/2002 01:31                                                                                   
                    PM                                                                                                 
                                                                                                                       
                                                                                                                       




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





-- 
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