title: mysql inserting into 2 tables at once that have primary key and foreign key
body: <p>I have two tables</p>
  
  <p><strong>books table</strong></p>
  
  <ul>
  <li>ID (PK)</li>
  <li>Title</li>
  <li>Author</li>
  <li>Genre</li>
  <li>ISBN</li>
  <li>Price</li>
  <li>publisher</li>
  <li>Year</li>
  </ul>
  
  <p><strong>bookAwards table</strong></p>
  
  <ul>
  <li>ID (FK) -- referencing Books.ID</li>
  <li>Awardname</li>
  <li>Year</li>
  </ul>
  
  <p>ID of bookAwards is foreign key of ID in books table.</p>
  
  <p>How can I insert into books table at the same time into bookAwards table?</p>
  
  <p>When I am trying to insert into books table it gives the error that foreign key causes?</p>
  
  <p>I want to insert into books table the values and then an awardname with a year into bookAwards?</p>
  
  <p>Any help will be much appreciated.</p>