Get records inside a specific range of date

A

Anonymous

Guest
Guys

I got records with dates in it. I want to get records from a specific range date that i will input. lets say i want records from Jan 15, 2005 to March 28, 2005 and also with the name i specify. How can we do that.

I am thinking of making 3 textboxes 1 for the name, 1 for the start date and 1 for the end date.

please help. thanks.
 
the query would be

Code:
<?php
$sql = "
select col_names, ....
from table_name
where name = '{$name}'
and date_column between '$startdate' and '$enddate'
";
?>
 
i also got a problem with getting records on specific date range..actually i got my expected result but before i insert the range date..there is an error with mysql_fetch_array...after inserting the date, then there is no prob already...i also want the records from different tables to be displayed..let say by inserting the date range, the records that are going to be displayed are the total 1 and total 2...total 1 and total 2 result come from different tables...at this moment, i just can display the records from table of total 1

this is my coding:
Code:
$startdate = $StartYear."-".$StartMonth."-".$StartDate1." 00:00:00";
$enddate  = $EndYear."-".$EndMonth."-".$EndDate1." 23:59:59";
			
	
if ($ApplicationCode==1)
{
$sql="select count(*) as Total, DateInsert from MOMessage  where DateSend >= '$startdate' and DateSend<= '$enddate' and ApplicationCode=1 group by DateInsert";
$result=mysql_query($sql);
						
}
$no=1;
while ($row = mysql_fetch_array($result))
{
$DateInsert = $row["DateInsert"];
$Total = $row["Total"];
		
echo "<tr>"; 
echo "<td><div align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">$no</font></div></td>";
echo "<td><div align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">$DateInsert</font></div></td>";
echo "<td><div align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">$Total</font></div></td>";
echo "</tr>";
$no++;
} //end while

thanks in advance
 
Back
Top