Mysql/PHP query problem with datetime field.
I am trying to use a SELECT query to retrieve the earliest and the latest date/ time entries from my table. The field is a datetime (YYYY-MM-DD HH-MM-SS). I cannot find anything related to querying datetime in the MySQL manual.
What is the proper way to approach this?:confused: When I do a $firstdate = mysql_query("SELECT MIN(datestamp) from seminar") and then echo $firstdate I get the following Resource id #5 |
Quote:
|
As it turns out using MIN and MAX on a datetime field doesn't work the way I expected. It returns more than one record in decending order by value. I went with a mysql_fetch_array() and then set $i=mysql_num_rows($fetch) and did a mysql_data_seek($fetch, $i). Worked like a charm. Thanks anyway markus.
|
All times are GMT -5. The time now is 11:51 AM. |