php - Why the SQL query is not working after addition of two new fields to the query? -


i've following sql query working absolutely fine .

$sql = "insert user_login (user_id, email, password, token)     values ($user_id, '$email', '$user_password', '$token')"; 

now i've added 2 new fields respective table called 'token_creation_time' , 'token_last_accessed_time'. these fields contain current time values(i.e. unix time stamp values). purpose used time() function php in sql query follows didn't work. don't know i'm making mistake.

$sql = "insert user_login (user_id, email, password, token, token_creation_time, token_last_accessed_time)     values ($user_id, '$email', '$user_password', '$token', time(), '')"; 

the last 2 field's structure in mysql db follows :

name : token_creation_time type : int(10) collation :  attributes : null : no  default : none :   name : token_last_accessed_time type : int(10) collation :  attributes : null : no  default : none :  

in query want insert current time stamp value field 'token_creation_time'.

thanks.

just change null:no null:yes,it should work

name : token_last_accessed_time type : int(10) collation :  attributes : null : yes  default : none :  

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -