I was wondering how I can include a variable to an sql query. The issue is that the code is being gathered as this way. Here is the code:
$timestamp = mktime(0, 0, 0, date("n"), date("j") - time(), date("Y"));
$checkTime = date("Y.m.d", $timestamp);
This the original sql query. Here is the code:
$sqlResult = mysql_query("SELECT COUNT(id) FROM id WHERE timestamp = '".$checkTime."'");
Database timestamp entries
2013.12.21
2013.12.23
The code that I am using right now is written for php time epoch time, I noticed I had my variable missing. Here is the code:
$sqlResult = mysql_query("SELECT COUNT(id) FROM id WHERE timestamp >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 29 DAY)) GROUP BY DAY(FROM_UNIXTIME(timestamp))");
Database timestamp entries
1390537347
1390536900
How can I incorporate my $checkTime
tag into my second sql query?