I'm going to insert into database id_user, date_registration and time_registration, but that not working. A problem involve id_user, but I don't know where. I hope someone help me.
public function insert_statistics()
{
$login = $this->data['login'];
$date = date("Y-m-d");
$time = date('H:i:s');
if(empty($this->validation->getErrors())) {
$query = $this->database->connect()->prepare("INSERT INTO statystics
(`id_user`, `date_registration`, `time_registration`)
VALUES((select id from users
where login = :login
),
:date_registration, :time_registration)");
$query->bindParam(':login', $login, PDO::PARAM_INT);
$query->bindParam(':date_registration', $date, PDO::PARAM_STR);
$query->bindParam(':time_registration', $time, PDO::PARAM_STR);
$query->execute();
}
}