topflight Posted February 18, 2009 Share Posted February 18, 2009 I have table called hours. Every time a member insert the hours they insert it like 0.5=50mins 1.0=1 hour and etc... Well I want to show all the members hours on their profile page. their is a row called time and login. I was wondering is their anyway to have it set up so that the database will add and give me a result of all the hours added from a certain member. For Instance say like member 5555 1 day has 0.2 another day has 1.0 and 9.5 Is their a way I can add all those times together just from that member only? because also in the hours table I have id so once they submit their hours the ID gets inserted to. What code or how will I do this? Thanks in Advanced. Quote Link to comment https://forums.phpfreaks.com/topic/145813-adding-information-from-the-mysql-databse/ Share on other sites More sharing options...
premiso Posted February 18, 2009 Share Posted February 18, 2009 SELECT sum(hours) FROM table_name WHERE member = '5555'; That will give you the hours, you can calculate days using basic math techniques. Quote Link to comment https://forums.phpfreaks.com/topic/145813-adding-information-from-the-mysql-databse/#findComment-765571 Share on other sites More sharing options...
Maq Posted February 18, 2009 Share Posted February 18, 2009 0.5=50mins 1.0=1 hour This doesn't make any sense to me. Do you mean 0.5 = 30mins? Quote Link to comment https://forums.phpfreaks.com/topic/145813-adding-information-from-the-mysql-databse/#findComment-765578 Share on other sites More sharing options...
topflight Posted February 18, 2009 Author Share Posted February 18, 2009 0.5=50mins 1.0=1 hour This doesn't make any sense to me. Do you mean 0.5 = 30mins? Yes I apologize about that yes 0.5 = 30 Quote Link to comment https://forums.phpfreaks.com/topic/145813-adding-information-from-the-mysql-databse/#findComment-765582 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.