in your SQL query, use the mysql function curdate()
example:
INSERT INTO table (column, date, column) VALUES (’value’, curdate(), ‘value’)
First, don’t use “timestamp”: that is UNIX time stamp: the number of seconds since January 1 1970 00:00:00 GMT
Set the column variable as “datetime” type with the default value 0000-00-00 00:00:00 (for a format YYYY:MM:DD HH:MM:SS), and call this column “datum” (don’t use “date”, “datetime” or “timestamp”!: reserved words)
Advantage of this format: easy sorting!
When inserting, use:
$datum = date ( “Y-m-d H:i:s”);
This will get current time and date, correctly formatted.
Your sql:
$sql = “insert into `tablename` (`field1`,`field2`,`datum`)
values (’ ” . $f1val . ” ‘ , ‘ ” . $f2val . ” ‘ , ‘ ” . $datum . ” ‘ ) “;
Table Name:
Column 1:
Column 2:
Column 3: