I have a invoice type form submission and every submission has a date so I have created a varcha date field in mysql database to save the time.Time format is like '2011-06-26'.Now I need to select a range based on the date from my database.I tried following options but they don't display any result just blank page is displayed,even no errors.
Should I follow some special techniques on saving date to my database.If so please give me some explain about that because I am new to PHP and MYSQL development.
SELECT * FROM table_name
WHERE 'date'
BETWEEN UNIX_TIMESTAMP('2011-06-02') AND UNIX_TIMESTAMP('2011-06-25')
SELECT * FROM my_table
WHERE 'date'
BETWEEN CAST('2011-06-02' AS DATE) AND CAST('2011-06-25' AS DATE)";
This is what I used to extract data
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
echo $row['tax']."<br>";
}
Thank you.