-1

In my database the date is like this 24 june 2016, 09:17. And there are many data in my db. I am gonna use this code in my web site.

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

echo $numrows = mysql_num_rows($query);

I am checking today's date. But only date not time. However my database has time and date. I want this; If the date of today same with my any dates in my db, show me how many data in my db. For example my new data is like this 3 june 2016 but in my db like this 3 june 2016, 09:17. How can it work.

I want something like this

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

2 Answers2

0

You have to add the comma to the date format and then use only first part of exploded array, so part of code is:

$t    =   date("Y-m-d, H:i:s");

$nwdate   = explode(",", $t)[0];

Moreover you don't need this row, is useless. Delete it and use only variable $t.

$t2   =   date($t);  
von Oak
  • 823
  • 5
  • 14
0

You have to use $t = date("Y-m-d");