made tracking table in my DB where I am saving which urls was visited at which time.
const INSERT_TRACKING_SQL = "
INSERT INTO `custom_tracking` (
`utidId`, `url`, `urlParams`, `time`
)
VALUES
(
:utidId, :url, :urlParams, now()
);
";
$conn = $entityManager->getConnection();
$stmt = $conn->prepare(self::INSERT_TRACKING_SQL);
$stmt->bindParam(':utidId', $utid_db_id);
$stmt->bindParam(':url', $url);
$stmt->bindParam(':urlParams', $urlParams);
$stmt->execute();
$tracking_id = $conn->lastInsertId();
But after executing the SQL command and getting ID of new record trough lastInsertId() I got last record witch have same parameters (except time) and any new record is not inserted into DB
My Answer:
"INSERT INTO tracking (url, visited_at) VALUES (:url, :visited_at)";
Rate this post
3 of 5 based on 1789 votesComments