CodeIgniter Forums
Click counter or more visited (Solved) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Click counter or more visited (Solved) (/showthread.php?tid=47016)



Click counter or more visited (Solved) - El Forum - 11-23-2011

[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 ;

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