Hello, please tell me whether it is possible to make a request to the database of this type:
select all records with a date less than the specified one - a line like: "04/03/14 2:42 pm"
Now I make a request and then the condition:
$date = "03.04.14 14:42"; $query = "SELECT *, DATE_FORMAT( CONVERT_TZ(created,'+00:00','+04:00'), '%d.%m.%y %H:%i' ) as date_f FROM items ORDER BY created DESC"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $i++; if ($i <= 500 AND $row['date_f'] <= $date){ echo $row['date_f']."<br />"; } }
But the fact is that the result of the condition displays only the dates for the current month:
03.04.14 14:42 03.04.14 13:36 03.04.14 13:29 03.04.14 09:55 03.04.14 08:49 02.04.14 15:52 02.04.14 13:54 02.04.14 13:42 02.04.14 12:28 02.04.14 12:10 02.04.14 11:22 02.04.14 11:12 02.04.14 11:04 02.04.14 10:59
How can I make a SQL query or a condition so that the result displays ALL dates less than the original one?