title: Insert into data fail after foreign key rebuilded.Mysql PHP
body: <p>I hava two table:IDCa and IDCb.At the beginning, each table has data and works fine. Table IDCb has foreign key sheetNum with IDCa's primary key sheetNum. </p>
  
  <p>When I renamed IDCa to IDCabk,and drop IDCa, it worked failed.
  So I runned: set foreign_key_checks=0
  ,  drop table IDCa, create table IDCa like IDCabk.</p>
  
  <p>Now IDCa is empty.After that, I found IDCb's REFERENCES table had changed from IDCa to IDCabk. So I drop IDCb foreign key ,and readded like:</p>
  
  <pre><code>alter table IDCb add constraint fk_dvcOnsh foreign key (sheetNum) references IDCa(sheetNum);
  </code></pre>
  
  <p>After  I runned: set foreign_key_checks=1, and tried insert into data.But unfortunately,  it works fail.It seems nothing wrong.</p>
  
  <p>Here IDCa information, run :show create table IDCa :</p>
  
  <pre><code>|IDCa        | CREATE TABLE `IDCa` (
  `sheetNum` int(255) NOT NULL AUTO_INCREMENT,
   .........
   PRIMARY KEY (`sheetNum`)
   ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8
  </code></pre>
  
  <p>Here IDCb information, run： show create table IDCb :</p>
  
  <pre><code> |IDCb        | CREATE TABLE `IDCb` (
   `id` int(255) NOT NULL AUTO_INCREMENT,
   ......
   `sheetNum` int(255) DEFAULT NULL,
   PRIMARY KEY (`id`),
   KEY `fk_dvcOnsh` (`sheetNum`),
   CONSTRAINT `fk_dvcOnsh` FOREIGN KEY (`sheetNum`) REFERENCES `IDCa` (`sheetnum`)
   ) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8 
  </code></pre>
  
  <p>My  code of inserting into data:</p>
  
  <pre><code> $conn-&gt;beginTransaction();
   $query="insert into IDCa(xxx) values('aaa')";
   $stmt=$conn-&gt;query($query);
   $stmt-&gt;closeCursor();
  
   $query="insert into IDCb(rrr,sheetNum) values('aaa',LAST_INSERT_ID())";
   $stmt=$conn-&gt;query($query);
   $stmt-&gt;closeCursor();
   $conn-&gt;commit();
  </code></pre>
  
  <p>Show Error:</p>
  
  <pre><code>SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`hpc`.`IDCb`, CONSTRAINT `fk_dvcOnsh` FOREIGN KEY (`sheetnum`) REFERENCES `IDCa` (`sheetnum`))fail
  </code></pre>