Neha
Neha

Reputation: 85

cant input today date with sql

$sql=$Db1->query("INSERT INTO TABLENAME SET username='$username', log='Log text here ', date='".date()."'");

The problem is below

username and logs are inserted correctly but date is not saved , it saves 0000-00-00 etc Thanks to solve this

Upvotes: 1

Views: 30

Answers (1)

Ansh
Ansh

Reputation: 94

Make the date column type in your table as "TIMESTAMP" and change the code to this

$sql=$Db1->query("INSERT INTO TABLENAME SET username='$username', log='Log text here ', date=NULL");

Upvotes: 1

Related Questions