Anthony.Jay
Anthony.Jay

Reputation: 57

Multiple insert in database with one transaction id

Is it possible to have one transaction_id for multiple inserts in the database? Given that I have a table that has 5 rows.

So I'm able to insert that to the database when I hit submit. But transaction_id will be different for every insert. Is there a way around for this? Really new to PHP. And transaction_id is an auto increment.

Upvotes: 0

Views: 959

Answers (1)

Sherif Tarek
Sherif Tarek

Reputation: 329

The transaction_id seems to be a primary key and the primary key can't be repeated. I think one of the possible solutions is to make another column as a foreign key and stores the unique id in another table. Now the primary keys in transactions will be unique and the column added may be repeated as needed.

Your Schema is going to be like this one:

Your Schema is going to be like this one

Upvotes: 1

Related Questions