[apologies in advance for my english]
i have a column in my database table event_start_date (user input datetime) and my requirement is to get data of x days ahead of current datetime. and value of event_start_date in the resulting record should be greater than or equal to NOW() (current date time)
`event_start_date >= NOW()` (using php or mysql)
this is what i have done so far (zend in magento):
$sql = $read->select() ->from(array('e' => 'my_table'));
$where = "e.event_start_date = DATE(DATE_ADD(e.event_start_date, INTERVAL x DAY))";
$sql->where($where);
echo $sql->__toString();exit;
// this results in
SELECT
e.* FROM 'my_table' AS 'e' WHERE (e.event_start_date = DATE(DATE_ADD(e.event_start_date, INTERVAL x DAY)))
another i used is
SELECT
e.* FROM 'my_table' AS 'e' WHERE DATEDIFF(e.event_start_date,DATE(DATE_ADD(e.event_start_date, INTERVAL {$x} DAY)));
both output one row if x = 1 only. what would be the solution? i am kinda stuck.
appreciate your help a lot.
thanks,