I want to create this counter to count every time a link has been clicked to download an item and to reflect this value inside posts. ( especially blogs posts)
I have created a table in my database called " book_downloads " to store the download counts and timestamps:
CREATE TABLE book_downloads (
book_id INT(10) UNSIGNED NOT NULL,
download_count INT DEFAULT 0,
last_download TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (book_id),
FOREIGN KEY (book_id) REFERENCES node(nodeid)
);
This table links book_id to the nodeid of the blogs post in the node table, ensuring data integrity through a foreign key constraint.
And then I have lost the road with HOOKS and templates, finally I came here.
I have created a table in my database called " book_downloads " to store the download counts and timestamps:
CREATE TABLE book_downloads (
book_id INT(10) UNSIGNED NOT NULL,
download_count INT DEFAULT 0,
last_download TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (book_id),
FOREIGN KEY (book_id) REFERENCES node(nodeid)
);
This table links book_id to the nodeid of the blogs post in the node table, ensuring data integrity through a foreign key constraint.
And then I have lost the road with HOOKS and templates, finally I came here.



Comment