I would like to fetch one or several rows from the databases (depedning on results) for a flight ID and a given date. However, I do not know how I can do that. I got the flightId (called flight in table) and I got a unixtimestamp for the date of the flight.
What should my query look like?
This is my table:
CREATE TABLE IF NOT EXISTS `flight` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`foreign_id` int(11) DEFAULT NULL,
`flight` varchar(45) DEFAULT NULL,
`origin` varchar(100) DEFAULT NULL,
`notes` mediumtext,
`date_original` datetime DEFAULT NULL,
`date_current` datetime DEFAULT NULL,
`type` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;
Edit
I have tried several queries, but since I only have the timestamp I can't seem to figure out how to get it from a timestamp to a datetime concerning only the date in question. The timestamp gives an exact second of the day, however, I need to search the whole day (e.g. 2013-04-26 00:00:00 to 2013-04-26 23:59:59)...
So basically, I can't get futher than...
SELECT date_original, notes FROM flight WHERE flight = '{$a_sFlightId}' AND date_original ...?