MySQL database, with table Table 1 fields: NO_CRT, PRODUCT, PIECES PRICE_PCS. TOTAL PRICE
- MySQL
database , with table
Table 1 fields:
NO_CRT,
PRODUCT,
PIECES
PRICE_PCS.
TOTAL PRICE
(ION user, no password).
There can be a maximum of two products with the same name (PRODUCT) and the same PRICE_PCS.
The NO_CRT field has a unique value for each item.
Reading from the keyboard a PRODUCT, respectively PRICE_PCS (using an HTML file to be written), by pressing a button the following operations will be performed (in a PHP script file):
- search in the table of how many products with the same name PRODUCT and PRICE_PCS exist;
- if no item is found, this will be signaled by a message (and exits the program);
- if only one item is found, this item will be displayed in a table;
- if two are found: - the second found item is deleted, and the data following it (more precisely PIECES) are transferred (added) to the remaining items (normally, also in the PIECES
field);
- NO_CRT,is redone for the following deleted items (to have a successive numbering);
- recalculate TOTAL PRICEfor the remaining item and display the item (TOTAL_PRICE= PIECES x PRICE_PCS)
Step by step
Solved in 2 steps with 1 images