php - How could I insert date from mktime into MySQL? -


i want insert date in format m-d database. used code

$date1=date("m-d",mktime(0,0,0,$month1 ,$day1,1));  

the date inserted 0000-00-00 in mysql, , don't know why.

i want compare date stored in mysql current month , day. how can done?

mysql date must of form y-m-d . building date m-d form brings invalid date.

if want compare month or day, can use mysql month , dayofmonth functions. example:

$query = "select * table month(datecol) = {$month1} , dayofmonth(datecol) = {$day1}" 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -