princeofpersia Posted November 24, 2010 Share Posted November 24, 2010 Hi Guys I have two table in mysql one is users and the second one is profiles my database name is movies users contains: users_id, username, password, email movies contains: id, user_id, name, movie_name, movielink I need users to login and then update their profile according to relational database setup so once user loggs in they can add the link of their movies to the database. Could some one help me with inserting data into relational database according to database setup I have introduced above? Appreciate your help in advance Quote Link to comment https://forums.phpfreaks.com/topic/219691-relational-mysql/ Share on other sites More sharing options...
Rifts Posted November 24, 2010 Share Posted November 24, 2010 I'm not sure if I'm understanding you correctly but here it goes. assuming you have a text input for the movie name with submit button have it insert into the database where userid of logged in user = userid in other db Quote Link to comment https://forums.phpfreaks.com/topic/219691-relational-mysql/#findComment-1139042 Share on other sites More sharing options...
ManiacDan Posted November 24, 2010 Share Posted November 24, 2010 Your structure is wrong (probably). What you really want is a table for Users (userid, username, etc) and atable for Movies (movieid, movieName, etc). Then you want a cross-reference table that has movieId and userId. This way, you're not duplicating the movie titles. If 100 people like The Matrix, using your method you'd have 100 instances of the title "The Matrix" in your table. Using mine, you'd only have one (plus 100 cross-reference rows). Now, if you're asking "how do I go about making a dynamic website such as this," there are plenty of PHP tutorials out there. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/219691-relational-mysql/#findComment-1139058 Share on other sites More sharing options...
princeofpersia Posted November 24, 2010 Author Share Posted November 24, 2010 I have two tables as you have suggested, all i need is how to get session for my user id Quote Link to comment https://forums.phpfreaks.com/topic/219691-relational-mysql/#findComment-1139169 Share on other sites More sharing options...
ManiacDan Posted November 29, 2010 Share Posted November 29, 2010 I suggested three tables, do you have three? What do you mean by "all i need is how to get session for my user id"? Google for PHP login systems, they're mostly session based. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/219691-relational-mysql/#findComment-1140885 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.