I have a database with date field is this format "2010.06.11. | 10:26 13"
What is need is a php array that would hold all the different dates, .i.e.
array[0] = "2010.06.09."
array[1] = "2010.06.10."
array[2] = "2010.06.11."
Currently I am doing it by selecting the whole table, then looping through the result and adding the date substr to an array if it is not already there.
Bu开发者_JAVA技巧t maybe there is a faster way? Thanks.
You can directly select only the distinct dates from the database:
SELECT DISTINCT SUBSTRING(date, 1, 11) AS date_string FROM table
精彩评论