php database modeling doubt

Asked

Viewed 105 times

0

I’ll make a system for a colleague so I’m doubtful how I model the database

I have a table with tbl_leituraAtual tbl_leituraAnterior tbl_consumo tbl_factorCorrecao = tbl_total

how do I make this total take the result of this calculation and insert it into the database??? I will do it in php


follows a photo of the system I will do in excel which modelgaem could use to make this system, and when the person type the value I want to already fill the field full value and then have a Ubmit button and save the data in the database. inserir a descrição da imagem aqui

  • First do not name the tables with the prefix TBL, if it is a table does not need TBL, it gets a cleaner form its database. Examples (Current Milk, Previous Milk, Consumption, Factorecao).

  • It is also not legal to use Camelcase on behalf of tables. Use the character _ (current milking, previous milking...)

1 answer

0

You could have only one table "readings". Where would store the date, reading, consumption, etc. Building the table with PHP makes it easier to query.

  • and how I would add several lines in the bank?

  • A simple INSERT. The table would have an autonumeric field and you would create a PHP form for your client to feed this data into the database.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.