Jump to content

Recommended Posts

No no no. Echo is used to display your string on the screen. You are just processing information here.

 

<?php
mysql_query("INSERT INTO ".$_POST['projectnumber']." (Date) VALUES ('" . date("m-d-y") . "')");
?>

 

You need to wrap your date() parameter with quotes aswell. I'm not sure if you can use Date as a fieldname. But if that works, then I guess you can.

Storing a date as mm-dd-yy in a database will result in the most painful experience for you and if your Date field happens to be a DATE data type, will result in invalid data (you will probably get 0000-00-00 in the database.)

 

Once you switch to use a standard DATE format, mysql has a CURDATE() function that returns the current date directly in the query statement.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.