I have a database that a time filed that is stored in this format “2010.06.04. | 18:53 01”.
What I need is to select rows that have a specific date, for example “2010.06.04.”
Right now I am doing it my first selecting all rows and then looping through them and adding ones with the specified date to a new array.
Maybe there is an easier way to do it and I somehow can select it using mysqli_query?
Thanks!
What you will need is a
likequery (http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html)Note The % is a wildcard that states any text can go here.
I would also consider switching that field to be DATETIME field, this would allow you to do alot more with the data. – Note be careful when doing this, I would recommend creating another field first then calculating the proper value. You can then drop the unwanted field.