PHP使用数据库内部爆炸


PHP Explode using inside of database

在我的数据库中,日期是2016年6月24日09:17。我的数据库里有很多数据。我要在我的网站上使用这个代码。

$query=mysql_query("SELECT*FROM siparisler where tarih='$nwdate'");

echo$numrows=mysql_num_rows($query);

我在查今天的日期。但只有日期而不是时间。然而,我的数据库有时间和日期。我想要这个;如果今天的日期与我数据库中的任何日期相同,请显示我数据库中有多少数据。例如,我的新数据是这样的,2016年6月3日,但在我的数据库中是这样的。它怎么能工作。

我想要这种

$query=mysql_query("SELECT*FROM siparisler where explose(",",date[0])='$nwdate'");

您必须在日期格式中添加逗号,然后只使用分解数组的第一部分,因此部分代码为:

$t    =   date("Y-m-d, H:i:s");
$nwdate   = explode(",", $t)[0];

而且你不需要这一排,也没用。删除它并只使用变量$t。

$t2   =   date($t);  

您必须使用$t=date("Y-m-d");