Hi,
I am just learning both MySQL and PHP, and have a question about a project I am working on. The first (and main) table for this project has the basic information about an refund request, including an autoincrement unique ID. Another table includes the products and uses the ID as a reference. The third table is the history of everything that happens to the request. For example, the information may be as follows.
Credit table
- ID - autoincrement
- status - requested, needs authorization, processed, etc
- agent - who entered the request
- customer - person requesting the refund
- other customer info
order table
- ID - reference to Credit table
- Item - item ID for amount requested
- quantity - number purchased
- price - price of each item
- (total information is calculated on above fields)
history table
- ID - reference to credit table
- seq - id for each history log
- old status - the previous status
- new status- the status after the update to the record
- agent - agent making the change
- notes - a description of what was done.
I have the PHP form that collects the data to be entered. My question is, since the first table is an autoincrement, what is the best way to insert a record into the Credit table, pull the ID that was just entered into the credit table and insert that ID into the order and history tables?
Thanx,
JustLearning