How do you declare a date datatype in a table? Is it simply the following?
CREATE TABLE sampleDB (..., sampledate DATE, ...)
Now, if I want to query from that using a string through a POST form:
<?php
$formdate = $_POST["inputname"];
if($formdate) {
echo "Searching using query: ".$formdate."<br>";
$db = new SQLiteDatabase("testDB.db");
$query = $db->query("SELECT * FROM sampleDB WHERE sampledate = ".$formdate);
while($entry = $query->fetch(SQLITE_ASSOC)) {
echo "result: " ... "<br>";
}
}
?>
This doesn't seem to work. It doesn't return the entry that I want.
When I store the date as a string and compare strings, all is well, but if SQLite has a DATE data type, I think there should be way to use it!