This topic is locked

Delete record after insert

7/17/2018 8:03:22 PM
PHPRunner General questions
mtpocket author

Greetings,
I just cannot seem to get this right & any suggestion will help.
I have 2 tables i.e. T1 & T2 respectively.

T1

CID - Int, AI, Primary

Name - varchar

Surname - varchar
T2

CID - Int

Name - varchar

Surname - varchar
After user adds into T1 it's inserted into T2 then deletes record from T1.

My problem arises when more records are added into T1, similar CID's are added into T2 due to T1 being an empty table.

How can I overcome this?
Thanks

MT

<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=25680&image=1&table=forumtopics' class='bbc_emoticon' alt=';)' />

admin 7/18/2018

I'm not sure I can decipher "similar CID's are added into T2 due to T1 being an empty table".
Also it doesn't really make sense to add a record to T1, create a copy of this record in T2 and then delete it from T1. Why don't you add it directly to T2. Looks like there is more to this story.

A
Athlon 7/30/2018

Seems an odd thing to do..why? If its to do something else that you are unable on an add page we can perhaps help?
However, simple solution is to add a prim key to T2..it will ignore the CID being the same and you can control what you delete just easier. IMO