I'm trying to create a shares table for the buy function and have tried multiple CREATE TABLE commands with no success.
Most recently, I tried:
CREATE TABLE IF NOT EXISTS 'shares' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, FOREIGN KEY(fk_user_id) REFERENCES users(user_id), 'stock_symbol' TEXT NOT NULL, 'stock_name' TEXT NOT NULL, 'stock_shares' INTEGER NOT NULL, 'stock_price' INTEGER NOT NULL);
When I enter the query, I get
ERROR: unknown column "fk_user_id" in foreign key definition
I'm not sure what I'm doing wrong here. I'm simply trying to create a foreign key from the users table to store the 'user_id'.
By the way, I'm running the query in phpliteadmin. I also tried this in the sqlite3 cli and got the same error message.