OBJECTIVE - I am trying to pull all entries from $dbTable that were entered between November 1, 2007 23:18:18 and December 8, 2007 23:18:18.
DECLARATIONS:
$dbTable = table name
date field info = `dAt` datetime NOT NULL default '0000-00-00 00:00:00'
FAILED ATTEMPT - it showed no errors, just didnt pull anything
$query = "SELECT * FROM $dbTable WHERE 'dAt' >= '2007-11-01 23:18:18' AND 'dAt' <= '2007-12-08 23:18:18'";
This worked, and displayed all dates, including dates in the range specified above.
$query = "SELECT * FROM $dbTable ORDER by 'dAt' DESC";
any ideas would be appreciated
thanks
2006-12-02
23:16:45
·
1 answers
·
asked by
f1avor_f1av
3
in
Computers & Internet
➔ Programming & Design
$i = 0;
$dbTable = "dAta";
$tabName = "dAt";
$start_time = "'2007-11-09 23:18:18'";
$end_time = "'2007-12-09 23:18:18'";
$query = "SELECT * FROM $dbTable WHERE $tabName BETWEEN $start_time AND $end_time ORDER BY DateTime DESC";
this just failed also, hehe
2006-12-02
23:45:59 ·
update #1
$dbTable = "dAta";
$tabName = "dAt";
$start_time = "'2007-11-09 23:18:18'";
$end_time = "'2007-12-09 23:18:18'";
$query = "SELECT * FROM $dbTable WHERE $tabName BETWEEN $start_time AND $end_time ORDER BY $tabName DESC"; Now that worked, forgive me ive been up all night. Ill still keep this open, hook somebody up with the points. maybee any other interesting things when searching DATETIME would be neat, have a good one
2006-12-02
23:51:35 ·
update #2