RAJESH K
RAJESH K

Reputation: 21

sql date query gets corrct record but not inserting properly

Query:

INSERT INTO job_seeker_membership (mem_seeker, mem_plan, mem_payoption,  
mem_date, mem_paystatus, mem_reqstatus, mem_status, mem_exdate)  
VALUES ('107', '11', 1, NOW(), 0, 1, 1, 2015-08-17)

above query running correctly but its inserting like 0000-00-00 in place of 2015-08-17

Upvotes: 0

Views: 22

Answers (1)

Scott
Scott

Reputation: 1922

If your field is set up as Date then it needs a string value in the format YYYY-MM-DD.

Passing it 2015-08-12, for example, is not in string format; it is in integer format. Use: '2015-08-12' instead

For your problem specifically:

INSERT INTO job_seeker_membership
(mem_seeker, mem_plan, mem_payoption, 
mem_date, mem_paystatus, mem_reqstatus, mem_status, mem_exdate) 
VALUES 
('107', '11', 1, NOW(), 0, 1, 1, '2015-08-17')

Upvotes: 2

Related Questions