JohnOP Posted August 1, 2011 Share Posted August 1, 2011 I am making a system where users can collect 5 gifts a day and send them to users. i have a table id - username - gift - date - quantity When a user joins the site a row is inserted for them for every gift and when they get new gifts i increment the quantity. I only want users to get 5 gifts per day so how would i know if there row was updated 5 times in that day? Before this i had two tables, one for recording there gifts quanitity and one for recording everytime they get a gift so i can match the dates and limit them to 5 but that wasnt working well when it came to sending them. Link to comment https://forums.phpfreaks.com/topic/243530-last-update-time/ Share on other sites More sharing options...
The Little Guy Posted August 1, 2011 Share Posted August 1, 2011 You should store a record every time a user gets a gift. select count(*) from my_table where date = '2011-08-01' and user_id = 123; Link to comment https://forums.phpfreaks.com/topic/243530-last-update-time/#findComment-1250482 Share on other sites More sharing options...
JohnOP Posted August 1, 2011 Author Share Posted August 1, 2011 I was doing that but i use images for the gifts. I was querying the table that records the gifts everytime a user gets one, then retrieving the gift name so i can show the correct images but if a user got 2 roses it would insert 2 rows for roses and when showing the images to send it would show 2 roses rather than just one (but the user has 2). Which is why i tried it this way that it doesn't matter how many they have it will only show one image with there quantity, if you get me lol. Link to comment https://forums.phpfreaks.com/topic/243530-last-update-time/#findComment-1250485 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.