sanderphp Posted May 2, 2008 Share Posted May 2, 2008 I would like to create a MySQL db to track the number of miles I ride on my bike per month for myself as well as my friends. My thoughts are a simple form with a few fields that get filled in. I have created very simple MySQL db's before but nothing where you have repetitive entries from the same users (hope that makes sense). What is the best way to go about this? One table per rider or would I just use a field to distinguish which rider I am looking at when I want to display information? Quote Link to comment https://forums.phpfreaks.com/topic/103804-solved-creating-a-database-to-track-miles-ridden/ Share on other sites More sharing options...
peranha Posted May 2, 2008 Share Posted May 2, 2008 Are you looking at a total for the month, or total for each day, and add at the end of the month? It can be done pretty easily either way. Quote Link to comment https://forums.phpfreaks.com/topic/103804-solved-creating-a-database-to-track-miles-ridden/#findComment-531426 Share on other sites More sharing options...
sanderphp Posted May 2, 2008 Author Share Posted May 2, 2008 probably both, but I think I need help with how to lay out the tables first. One table for user info and one for miles? Quote Link to comment https://forums.phpfreaks.com/topic/103804-solved-creating-a-database-to-track-miles-ridden/#findComment-531428 Share on other sites More sharing options...
peranha Posted May 2, 2008 Share Posted May 2, 2008 I would use 2 tables, and then use join statements to connect the 2. table 1 ID Rider table 2 ID Miles Rider_id Something along those lines is what I would do. if that is all you want to save. then you use sql SUM to count at the end of the month. Quote Link to comment https://forums.phpfreaks.com/topic/103804-solved-creating-a-database-to-track-miles-ridden/#findComment-531430 Share on other sites More sharing options...
sanderphp Posted May 2, 2008 Author Share Posted May 2, 2008 Ok, great! Would I go to the PHP Help forum to get help on how to join the tables in my form? Quote Link to comment https://forums.phpfreaks.com/topic/103804-solved-creating-a-database-to-track-miles-ridden/#findComment-531431 Share on other sites More sharing options...
sanderphp Posted May 2, 2008 Author Share Posted May 2, 2008 If I wanted to user login's to access the database, would I need to create a 3rd table or could I just add a field to the riders table for a password? Quote Link to comment https://forums.phpfreaks.com/topic/103804-solved-creating-a-database-to-track-miles-ridden/#findComment-531459 Share on other sites More sharing options...
sanderphp Posted May 2, 2008 Author Share Posted May 2, 2008 Tried it and it worked. Quote Link to comment https://forums.phpfreaks.com/topic/103804-solved-creating-a-database-to-track-miles-ridden/#findComment-531483 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.