selecting unique values from a column
Use this query to get values
SELECT * FROM `buy` group by date order by date DESC
use
SELECT DISTINCT Date FROM buy ORDER BY Date
so MySQL removes duplicates
BTW: using explicit column names in SELECT
uses less resources in PHP when you're getting a large result from MySQL
Use the DISTINCT operator in MySQL:
SELECT DISTINCT(Date) AS Date FROM buy ORDER BY Date DESC;