检查第一个表中插入的数据是否存在,如果插入的数据在第一个表中存在,则将数据添加到第二个表中,否则不插入


check the existing of a inserted data in 1st table, if inserted data exist in the 1st table then add data into second table otherwise not inserted

在php中使用mysqli首先我们要检查在第一个表中插入的数据的存在,如果插入的数据存在于第一个表中,那么将插入的数据添加到第二个表中,否则不插入?

我们该怎么做?

简化:

您可以为每个值包含一个唯一的键,并在表1中测试该键,如果存在,然后将数据插入到表2中。