gott Posted November 5, 2006 Share Posted November 5, 2006 Hello. I have a question for your expertise.I currently have a mysql database with two tables, one with static information about tanks that will always stay the same (height, diameter, capacity, etc.) and another table with dynamic information that will change regularly (levels, products inside), approximately 3 times a day. at 7, 3 and 11. My question is how do I make the dynamic table work with dates and times? Is it better to have one giant table or generate a new one for every date and time. Also, what would be the best PHP functions to use to do the dates and times.Also, I am using the tank number (varchar) as the primary key for each database as of right now.Thank you for your help. Quote Link to comment https://forums.phpfreaks.com/topic/26243-mysql-table-question/ Share on other sites More sharing options...
jsladek Posted November 6, 2006 Share Posted November 6, 2006 Sounds like it really depends on if you need to keep historical records of the levels, products inside. If not then an update of the current values should be fine if you do need a record or Log of the tank inventory then a date_time feild would probably work well. Then you can select the latest time for the most current inventory.php function: date() would be a start. http://us3.php.net/dateIf you go with storing the historical dates then change the tank number in the second table from a primary key to a foreign key and create a new primary key feild, make it auto incrementing. Regards,John Sladek Quote Link to comment https://forums.phpfreaks.com/topic/26243-mysql-table-question/#findComment-120480 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.