It looks right, except that since
timestamp is a keyword in MySQL you need to enclose it in backticks. Oh...and
database is also a keyword, so same problem.
I assume that your column named
timestamp is indeed of data type
timestamp?
Code:
SELECT * FROM `database`
WHERE `timestamp` BETWEEN '2012-09-27 03:58:54' AND '2012-09-26 22:58:54'
*If* your
timestamp column is actually a UNIX (Linux) timestamp--and therefore just an INT data type in your schema--then you have to use a function to convert it...or convert the two BETWEEN times to UNIX timestamps (which will be much more efficient if that field is indexed).
In the future, make life simpler for yourself: Don't use MySQL keywords for column names.