Insert a date to MySQL with php is always 0000-00-00

37
February 17, 2021, at 10:00 AM

I'm trying to insert date_start and date_end fields into MySQL 8.0.23:

 $date_start = date('Y-m-d', strtotime('2021-01-01'));
 $date_end = date('Y-m-d', strtotime('2021-01-02'));

here is the query :

INSERT INTO ps_price_list (date_start, date_end)
VALUES ($date_start, $date_end);

I am not using anonym parameters since this is just an example.

The issue is that it gets successfully inserted but the values are '0000-00-00'. How can I manage to insert the date correctly ?

Answer 1
 $date_start = date('Y-m-d', strtotime('2021-01-01')));
 $date_end = date('Y-m-d', strtotime('2021-01-02')));

is wrong use

 $date_start = date('Y-m-d', strtotime('2021-01-01'));
 $date_end = date('Y-m-d', strtotime('2021-01-02'));
READ ALSO
How to display the date field in input box after submitting the form in javascript?

How to display the date field in input box after submitting the form in javascript?

I need to display the user-selected date in the input box on the same page once the form gets submittedI was referring this link and if I try to implement the same in my code, my form is not getting submitted and am not able to see the desired output

42
BMI Calculator program with Tkinter()

BMI Calculator program with Tkinter()

I want to create a BMI calculator program with Tkinter but I'm stuck at calculation procedure I use StringVar() to keep user data to calculate but I don't know how to calculate

50
Multi level product flavors in buildVariant in Android

Multi level product flavors in buildVariant in Android

Our app has default buildtypes and productflavors as

71