onthespot Posted July 22, 2009 Share Posted July 22, 2009 Hey. So I have a user table where I have many fields for users. I need to make a table called userstats now. The primary key in USERS is username. The foreign key in USERSTATS will be the username from USERS. Will this work? And what should I make the primary key in USERSTATS? Thanks Link to comment https://forums.phpfreaks.com/topic/166969-cant-get-my-head-around-this/ Share on other sites More sharing options...
smerny Posted July 22, 2009 Share Posted July 22, 2009 you should use autoincrement int for primary keys, and name the field "ID"... for both tables Link to comment https://forums.phpfreaks.com/topic/166969-cant-get-my-head-around-this/#findComment-880318 Share on other sites More sharing options...
onthespot Posted July 22, 2009 Author Share Posted July 22, 2009 yeah i understand that much, but i have a fully functioning website now, and used username, so i will learn for next time. My point is can u have a primary key the same as a foreign key? Link to comment https://forums.phpfreaks.com/topic/166969-cant-get-my-head-around-this/#findComment-880325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.