Jump to content

Mysql Table Question


gott

Recommended Posts

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.
Link to comment
Share on other sites

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/date

If 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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.