there is a table in the format
CREATE TABLE IF NOT EXISTS `statistic` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_user` int(11) NOT NULL, `id_org` int(11) NOT NULL, `id_driver` int(11) NOT NULL, `coins` int(11) NOT NULL, `data` bigint(20) NOT NULL, UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=20110 ; now I am making a simple sample from the table by the ID with such a query
$result = $connection->query("SELECT * FROM statistic WHERE `id_user`=".$users[$i]['id']); And there are dates in the range that you need to make a sample for example 20-03-2019 29-03-2019
Question: how is it possible to formulate a request in order to get only the necessary data sample as a result?
The date in the database is stored in the format of Unix tags.
data between метка1 and метка2. And calculate the values for meptoks before the request or in the request itself usingunix_timestamp(). PS Never substitute variable values directly into the query, use prepared queries and value binding. php.net/manual/ru/pdostatement.bindparam.php - MikeSELECT CAST(20190101121530 AS DATETIME);->2019-01-01 12:15:30... - Akina