title: How do you insert into an sqlite table with foreign key
body: <p>Hello I need help with an sqlite/Qt problem. The schema for the table is</p>
  <pre><code>CREATE TABLE PROJECT (
  &quot;pro_id&quot; INTEGER NOT NULL DEFAULT 1,
  &quot;app_id&quot; INTEGER NOT NULL DEFAULT 3,
  &quot;Start&quot; TEXT NOT NULL,
  &quot;End&quot; TEXT NOT NULL, 
  &quot;Output&quot; INTEGER NOT NULL,
  &quot;Log Type&quot; INTEGER NOT NULL, 
  &quot;Errors&quot; INTEGER NOT NULL, 
  &quot;Success&quot; INTEGER NOT NULL, 
  &quot;NOTES&quot; VARCHAR NOT NULL DEFAULT '',
  &quot;Duration&quot; TEXT NOT NULL DEFAULT '00.00.00.000',
  PRIMARY KEY(&quot;app_ID&quot;, &quot;pro_ID&quot;, &quot;Start&quot;),
  FOREIGN KEY (&quot;Output&quot;) REFERENCES &quot;OUTPUTS&quot; (&quot;ID&quot;) , 
  FOREIGN KEY (&quot;app_ID&quot;, &quot;pro_ID&quot;) REFERENCES &quot;PROJECTS&quot;(&quot;A_ID&quot;, &quot;P_ID&quot;), 
  FOREIGN KEY (&quot;Log Type&quot;) REFERENCES &quot;TYPE&quot; (&quot;ID&quot;));
  </code></pre>
  <p>The INSERT query (inside Qt) is</p>
  <pre><code>temp = &quot;INSERT INTO PROJECT (pro_id, app_ID, 
  Start, End, Output, Log Type, Errors, Success, NOTES, Duration) 
  VALUES(1,1, Date &amp; time in quotes, Date &amp; time in double quotes, '1, 1, 0, 0, '0.0.0.0.000')&quot;;
  </code></pre>
  <p>The error I get is:</p>
  <pre><code>QSqlError(&quot;1&quot;, &quot;Unable to execute&quot;, &quot;near \&quot;Type \&quot;: syntax error&quot;)
  </code></pre>
  <p>I feel like the problem is on the sqlite side and I'm not familiar with it at all. I started it only this year. I feel like the foreign key is where the issue is</p>