Hi - I am very new to this.
I have a joomla site where I am trying to get a date from a datepicker and display parts of my table using the date. Two major problems:
Datepicker - for future.
$dateSelected1 = $dateSelected . " 00:00:01";
$dateSelected2 = $dateSelected . " 23:59:58";
echo 'x' .$dateSelected1 .'x';
echo "<br>";
echo $dateSelected2;
echo "<br>";
$db_host = "localhost";
$db_database = "whatsonthatday";
$db_username = "digitach";
$db_password = "";
$dbcnx = mysql_connect($db_host,$db_username,$db_password);
mysql_select_db($db_database);
//$query = "SELECT * FROM 'whatson' where fldDate between '$dateSelected1' and '$dateSelected2' ";
$query = "SELECT * FROM whatson
where fldDate between '2016-06-21 00:00:00' and '2016-06-21 23:59:59'";
//$query = "SELECT * FROM whatson
";
echo $query;
echo "<br>";
$q = mysql_query($query);
echo $q;
This works as expected:
DateSelect:
2016/06/21
x2016/06/21 00:00:01x
2016/06/21 23:59:58
SELECT * FROM whatson
where fldDate between '2016-06-21 00:00:00' and '2016-06-21 23:59:59'
Resource id #244
Total number in the database is 4
2016-06-21 18:00:002016/06/212016-06-21 18:00:002016/06/212016-06-21 21:00:002016/06/212016-06-21 21:00:002016/06/21
But, of course, I don't want this.
When I comment out the $query = "SELECT * ........... line
And uncomment the line above I get:
DateSelect:
2016/06/21
x2016/06/21 00:00:01x
2016/06/21 23:59:58
SELECT * FROM 'whatson' where fldDate between '2016/06/21 00:00:01' and '2016/06/21 23:59:58'
Total number in the database is
Which means the query is the same but does not find the records.
Any help please??
Dave