Ali
2009-12-03 04:29:42 UTC
I'm building a basic php based website, and of course i use SQL database to make a login system.
Now suppose i have two table (Users, News)
Users -> usersID, name....and so on
News ->newsID, usersID, text....and so on
Now usersID in Users table is the Primary key..While i want the usersID in News table to be the Foreign Key.
I wrote down the foreign key in SQL " FOREIGN KEY (usersID) REFERENCES Users(usersID) "...
Now i make an account, it doesn't copy the usersID value from the original users table...in News table there is nothing..I want the value in Users->usersID = News-
It can't work, any ideas?