Snaggle Posted July 2, 2010 Share Posted July 2, 2010 I have a user system that lets users login to their own user page and update points on their account. I want to log each time a member adds points to their account to make sure no one is abusing the system. How can I go about storing a log file for each individual member, logging every time they add more points? And would it be possible to display this on a webpage for all to see? Link to comment https://forums.phpfreaks.com/topic/206474-creating-logs/ Share on other sites More sharing options...
inversesoft123 Posted July 2, 2010 Share Posted July 2, 2010 Create a log table with uinque id. second field user id. and go on inserting. Retrieve data where you want to show logs. Link to comment https://forums.phpfreaks.com/topic/206474-creating-logs/#findComment-1080066 Share on other sites More sharing options...
Cagecrawler Posted July 2, 2010 Share Posted July 2, 2010 The best way would be to create a database table with a row for each time the points where updated for each user. As an example: CREATE TABLE `test`.`points_log` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `user_id` INT NOT NULL , `points_updated` INT NOT NULL , `time` DATETIME NOT NULL ); Then you can easily pull out records for each user, for a time period etc. Link to comment https://forums.phpfreaks.com/topic/206474-creating-logs/#findComment-1080067 Share on other sites More sharing options...
Snaggle Posted July 2, 2010 Author Share Posted July 2, 2010 Thanks guys. I got the table setup and I wrote a query to insert into it. I assume to display the data for a certain user I just call all rows with his username right? Link to comment https://forums.phpfreaks.com/topic/206474-creating-logs/#findComment-1080076 Share on other sites More sharing options...
Cagecrawler Posted July 2, 2010 Share Posted July 2, 2010 Yeah, for example if you wanted all entries for user 1 ordered by date: SELECT * FROM points_log WHERE user_id = 1 ORDER BY time DESC; Link to comment https://forums.phpfreaks.com/topic/206474-creating-logs/#findComment-1080079 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.