show count of rows between 2 dates
Posted
by
hello
on Stack Overflow
See other posts from Stack Overflow
or by hello
Published on 2013-10-31T21:45:45Z
Indexed on
2013/10/31
21:53 UTC
Read the original article
Hit count: 161
I am trying to show the number of rows that have a created_at
date between 2 dates.
Here is my code:
$result=mysql_query("select * from payments where
created_at between '2013/10/01 00:00:00' and '2013/10/30 00:00:00'")
or die('You need to add an administrator ' );
$counter = mysql_query("select * from payments where
created_at between '2013/10/01 00:00:00' and '2013/10/30 00:00:00'");
$row = mysql_fetch_array($result);
$id = $row['id'];
$num = mysql_fetch_array($counter);
$countjan = $num["id"];
However when i echo (<?php echo"$jan";?>
)this shows as 0
any idea how i can get this to work
P.s there is 1 row within this date range
© Stack Overflow or respective owner