Welcome Guest, Not a member yet? Register   Sign In
Click counter or more visited (Solved)
#1

[eluser]Leonel Folmer[/eluser]
Hello, I would like to create a simple counter of the most read news, I have a main news page with pagination with a link "Read more". So when the reader click this button record +1 in the news table field.

Here is the table news:

=============================================================

CREATE TABLE IF NOT EXISTS `news` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`sector` int(10) unsigned NOT NULL,
`unit` int(10) unsigned NOT NULL,
`date` date NOT NULL,
`title` varchar(80) NOT NULL,
`description` text NOT NULL,
`status` enum('Ativo','Inativo') NOT NULL DEFAULT 'Ativo',
`author` varchar(250) DEFAULT NULL,
`count` int(10) DEFAULT '0', // here is the field to record
PRIMARY KEY (`id`),
KEY `FK_news_sector` (`sector`),
KEY `FK_news_unit` (`unit`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

=============================================================




Theme © iAndrew 2016 - Forum software by © MyBB