Php / Mysql日期保存为“0000-00-00” [英] Php/Mysql date saved as '0000-00-00'

查看:142
本文介绍了Php / Mysql日期保存为“0000-00-00”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Mysql数据库,其中我保留了客户订单的日期。


日期是由php函数生成的 date('Ym-d') 。数据库中的两条记录的值为'0000-00-00'。一个来自澳大利亚的客户,另一个由意大利的客户创建。其他5000个订单很好。


我的问题是如何生成这样的日期?


感谢您的帮助

解决方案

唯一的原因,我可以找到是您的客户端输入不正确的日期格式或他已经输入一个空字符串。
记住Mysql中的日期格式是yyyy-mm-dd。


I have a Mysql database where i keep dates of the clients orders.

Date is generated by a php function date('Y-m-d'). Two records in my database have values '0000-00-00'. One was created by a client from Australia and another by a client from Italy. Other 5000 orders are fine.

My question is how is it possible to generate such date ? Could it be something with individual browser settings ?

Thanks for help

解决方案

The only reason what i can find is either your client has entered improper date format or he has entered an empty string. Remember the date format in Mysql is yyyy-mm-dd.

这篇关于Php / Mysql日期保存为“0000-00-00”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆