Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. Error: ER_NO_REFERENCED_ROW_2: Cannot add or update a child row: a
  2. foreign key constraint fails (`employee`, CONSTRAINT
  3. `fk_Employee_Exhibits1` FOREIGN KEY (`EnclosureID`) REFERENCES `enclosure`
  4. (`Enclosure`) ON DELETE NO ACTION ON UPDATE NO ACTION
  5.  
  6. var entry = {
  7. 'Zoo ID': 1,
  8. 'First Name': $("#firstNameEntry").val(),
  9. 'Last Name': $("#lastNameEntry").val(),
  10. 'Enclosure ID': enclosure.options[enclosure.selectedIndex].id,
  11. 'Shop ID': shop.options[shop.selectedIndex].id,
  12. 'Job Desciption': $("#jobDescriptionEntry").val(),
  13. 'Hire Date': today,
  14. 'Shifts': $("#shiftEntry").val(),
  15. 'Salary': $("#salaryEntry").val()
  16. };
  17.  
  18. insertEmployee = function(data, callback){
  19. var sql = "INSERT INTO employee SET ?"
  20. console.log(data)
  21. pool.getConnection(function(err, connection) {
  22. if(err) { console.log(err); callback(true); return; }
  23. // make the query
  24. connection.query(sql, data, function(err, results) {
  25. connection.release();
  26. if(err) { console.log(err); callback(true); return; }
  27. callback(false, results);
  28. });
  29. });
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement