Pythondesigns Posted July 3, 2006 Share Posted July 3, 2006 Lets say I want to create a click counter. For this click counter lets say there are 300 items which can be clicked on and therefore recorded. I want to be able to record how many clicks are made on each item each day.What is the best way to store this data in a database?I was thinking have a table with 3 columns. The columns would be:Item_ID, Date, Click_CountWhen it is clicked then it would check if there is already a date with that item it. If there is then update the row if not insert a new row with the date.Is this a suitable method?I want to make sure the method I use is suitable because at a later stage this could be dealing with 20,000+ items.Thanks Quote Link to comment https://forums.phpfreaks.com/topic/13560-how-to-store-click-counts-by-date/ Share on other sites More sharing options...
tfoster Posted July 3, 2006 Share Posted July 3, 2006 This sounds like an efficient method to me :) Quote Link to comment https://forums.phpfreaks.com/topic/13560-how-to-store-click-counts-by-date/#findComment-52507 Share on other sites More sharing options...
Pythondesigns Posted July 3, 2006 Author Share Posted July 3, 2006 But this would mean for every single item therewould have to be a row for each day.So for example... lets say if there were 20,000 items which have been there for 3 years... which is 1095 days. That would mean 21,900,000 rows.That doesnt sound too efficient to me... Quote Link to comment https://forums.phpfreaks.com/topic/13560-how-to-store-click-counts-by-date/#findComment-52511 Share on other sites More sharing options...
birdie Posted July 3, 2006 Share Posted July 3, 2006 make a cron job, export the tables every year or so. Also, you could make it so that the script creates a new table if there are to many rows in the current one? easy job right? Quote Link to comment https://forums.phpfreaks.com/topic/13560-how-to-store-click-counts-by-date/#findComment-52520 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.