Displaying data from a mysql database from start date to end date using php where user provides the start and end date
hi how to Display data from a mysql database from start date to end date u开发者_JS百科sing php codeigniter where user provides the start and end date through view page.. The start and end date are been fetched from the view page.... so it should be able to fetch the values from the start date till the end date from the mysql database.. ....
i get this output... it displays the current date
2009-11-01 00:00:00 SELECT * FROM border WHERE dateordered='2009-11-01 00:00:00'2011-05-04No Records Found2010-11-01 00:00:00 but i gave the start date as 04-05-2011 and end date 05-05-2011
$sql = 'SELECT * FROM table ORDER BY start_date ASC';
$q = $this->db->query($sql);
$results = ($q ? $q->result() : FALSE);
there you go....
$this->db->where("date BETWEEN '1970-01-01' AND '2011-05-11'");
I've never used CodeIgnitet, but I believe they use this kind of method to run the query.
Oh, I might have misunderstood you, if this is not what your looking for, see the answer of the other guy, just use an ORDER BY datefield
and use ASC
from oldest to newest or DESC
for newest to oldest.
精彩评论