0

The table is not creating because there is an error in the execution but I can't seem to find it, I want report ID to be a foreign key from the dataEntryTB id

aj.executeSql('CREATE TABLE IF NOT EXISTS reportTb (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, reportDetails TEXT NOT NULL, reportID INTEGER, FOREIGN KEY(reportID) REFERENCES dataEntryTb(id)');
lifeishard
  • 17
  • 6
  • What error are you getting in your error callback? Doesn't look like you have error callbacks handled. Look at http://stackoverflow.com/questions/3122057/reading-info-from-sqlite-database-syntax-how-do-i-use-it-in-html5-webapp – Steve Kennedy Apr 13 '17 at 19:29
  • They are not showing me an error but I know that execution is not working cause when I drop table and try to create it, it dont get created. Is that the correct way of creating a foreign key? – lifeishard Apr 13 '17 at 19:35
  • I don't know. But without an error, you're flying blind. I would add a callback function, in order to clearly see the error. The executeSQL function does provide errors, but you must use a callback function to see that error. – Steve Kennedy Apr 13 '17 at 19:52

0 Answers0