1

This statement works:

$query = "
SELECT COUNT(*) 
FROM " . $this->s_createtableName . " 
WHERE tm BETWEEN UNIX_TIMESTAMP(DATE(NOW())) 
AND UNIX_TIMESTAMP(DATE(NOW()) + INTERVAL 1 DAY)";

In trying to chain the query, this code fails on the WHERE statement.

$query->select('COUNT(*)');

$query->from('. $this->s_createtableName .');

$query->where("tm BETWEEN UNIX_TIMESTAMP(DATE(NOW())) AND UNIX_TIMESTAMP(DATE(NOW()) + INTERVAL 1 DAY)");

Any help would be appreciated.

2

I recommend using quote the table name.

You can try this. I guess you missed removing the dots in the from clause. If this does not work, please add the error message you get.

$query->select('COUNT(*)');

$query->from($this->s_createtableName);

$query->where("tm BETWEEN UNIX_TIMESTAMP(DATE(NOW())) AND UNIX_TIMESTAMP(DATE(NOW()) + INTERVAL 1 DAY)");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.