stuart7398 Posted April 15, 2008 Share Posted April 15, 2008 Hi. I think I have done a successful join, not sure. The first data table has the login and password. Primary key = 'id' Field 'login' Field 'password' The second data table has personal details such as 'name' address' Primary key = 'status' Field 'id' Field 'Name' Field 'Address' The problem I'm having is when I register as a new user, I see my first table data and other users data, where mine should empty until updated. And the 'id' field in the second table is left empty. How is it updated to match the first table? Any input appreciated. Thanks, Stuart. The Registration Page INSERT INTO security(name, login, passwd) VALUES('$name','$login','".md5($_POST['password']) Personal Details Page $data = mysql_query("SELECT * FROM personal, security WHERE security.member_id = '$SESS_MEMBER_ID'") OR DIE (mysql_error()); Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/ Share on other sites More sharing options...
stuart7398 Posted April 15, 2008 Author Share Posted April 15, 2008 I think I should be inserting the new users 'status' in the 'personal' table How would I join these 2 tables? Table 1 = 'security' Table 2 = 'personal' INSERT INTO security(name, login, passwd) VALUES('$name','$login','".md5($_POST['password']) Hi. I think I have done a successful join, not sure. The first data table has the login and password. Primary key = 'id' Field 'login' Field 'password' The second data table has personal details such as 'name' address' Primary key = 'status' Field 'id' Field 'Name' Field 'Address' The problem I'm having is when I register as a new user, I see my first table data and other users data, where mine should empty until updated. And the 'id' field in the second table is left empty. How is it updated to match the first table? Any input appreciated. Thanks, Stuart. The Registration Page INSERT INTO security(name, login, passwd) VALUES('$name','$login','".md5($_POST['password']) Personal Details Page $data = mysql_query("SELECT * FROM personal, security WHERE security.member_id = '$SESS_MEMBER_ID'") OR DIE (mysql_error()); Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-517592 Share on other sites More sharing options...
fenway Posted April 15, 2008 Share Posted April 15, 2008 Where's the JOIN condition? Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-517664 Share on other sites More sharing options...
stuart7398 Posted April 15, 2008 Author Share Posted April 15, 2008 That's what i'm learning, that's why people come here. If you have no productive answers or directions please stop responding Fenway. You knew nothing at some point, probably still don't. People come here to LEARN. Direct, encourage them. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-517668 Share on other sites More sharing options...
gluck Posted April 15, 2008 Share Posted April 15, 2008 You need to join on a common field. Your security table and personal table should have a common field for the join to work. I assume in this case member id is the field. so your joining condition should have this: personal.member_id = security.member_id which means display the matching records in both tables for a particular id. SELECT * FROM personal A, security B WHERE A.member_id = B.member_id and B.member_id = '$SESS_MEMBER_ID' OR SELECT * FROM personal A join security B on A.member_id = B.member_id where B.member_id = '$SESS_MEMBER_ID' Use Aliases: A, B for tables.. this will make reading easy. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-517876 Share on other sites More sharing options...
fenway Posted April 16, 2008 Share Posted April 16, 2008 If you have no productive answers or directions please stop responding Fenway. No direction? I provided you with a question that should have led you directly to the answer... but you insist on having all of the answers spoon-fed to you. You posted a query about joins without the word "join" in it... that should have been your first hint. People come here to LEARN. Direct, encourage them. You obviously have a warped sense of the word "direct" and "learn". You knew nothing at some point, probably still don't. Oh don't you worry... I'll make a point of NEVER responding to any of your posts again. Good luck with life... I sincerely hope that's not the way you treat others that respond to your countless requests for help. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518491 Share on other sites More sharing options...
stuart7398 Posted April 16, 2008 Author Share Posted April 16, 2008 RUBBISH!!! I sit here with a book and web tutorials. If I can't find the answer I ask for help. You've responded to a few of my posts with one liners. I don't come here for Riddles, Clues or Puzzles. I have tried blocking you, but obviously failed. You have the wrong forum fenway, you need this: http://www.funtrivia.com/quizzes/index.cfm Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518580 Share on other sites More sharing options...
fenway Posted April 16, 2008 Share Posted April 16, 2008 I take back my "NEVER" to make one final comment... RUBBISH!!! I sit here with a book and web tutorials. If I can't find the answer I ask for help. Then you made a poor choice of selecting books and tutorials -- caveat lector. You've responded to a few of my posts with one liners. I don't come here for Riddles, Clues or Puzzles. Just because you can't understand something doesn't make it a riddle or a puzzle. And just because you can't figure out why I thought a one-liner was sufficient to get the bottom of your "problem" doesn't make it a clue. I've responded over ~8K questions, many with one-liners -- no one else seems to have a problem. No join condition = full cartesian product = M x N rows. That's the ANSWER to your QUESTION. But I'm not going to write code for you -- a simple glance at the mysql refman would make it painfully obvious why you're not getting the desired output. But that would require far too much effort, I suppose. Oh wait, that's a one liner too... like I said before, you don't want help, you want someone else to tell you what to do so that you can cut & paste. That's not learning, btw... unless that's not why you're coming here. Any further discussion on this matter, and the thread will be locked. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518590 Share on other sites More sharing options...
stuart7398 Posted April 16, 2008 Author Share Posted April 16, 2008 It may be oblivious to someone who knows fenway. Say "mysql" or "php" to someone who does not know and you will get a blank expression. At one point, you knew sod all, today you know a little more. Unfortunately, you are to arrogant and fat headed to go back to when you knew nothing. I'm not asking you to respond. I've actually asked you not to respond once before. apart from being a *******, you're also stupid. You are not the only forum on the web. Lock the ***** you controlling little *******. Sad ********** Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518640 Share on other sites More sharing options...
Daniel0 Posted April 16, 2008 Share Posted April 16, 2008 @stuart7398: Do you know who Socrates was? He was a philosopher in the ancient Greece. He believed that by asking the right questions, the learner would come to the answer themselves. This is called maieutics. He also believed that one could not "get" knowledge, they'd have to learn it themselves. They could however be helped using maieutics. He believed that every individual had the knowledge within themselves, but it was only a matter of asking the right questions to get the learner to find the solution/answer himself instead of just giving it to him - otherwise he'd learn nothing. Bringing this into context, fenway is asking a question for you to find the answer yourself. He guided you towards the answer. He is thereby helping you by not just giving you the solution although it might take a little more effort from your side. I think fenway did the right thing here and I'd appreciate if you show respect to high ranking and respected members (and just any member in general) so that you yourself may be respected in return. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518642 Share on other sites More sharing options...
stuart7398 Posted April 16, 2008 Author Share Posted April 16, 2008 You actually know nothing fenway. You respond with one liners because you know little and are simply bumping up your 'post' scores. Sad bastard Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518643 Share on other sites More sharing options...
stuart7398 Posted April 16, 2008 Author Share Posted April 16, 2008 go away. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518647 Share on other sites More sharing options...
stuart7398 Posted April 16, 2008 Author Share Posted April 16, 2008 this is not a debate. i don't like fenway. i've asked him not to respond now you have an opinion. you know nothing of the past responses of fenway. so you have no place to judge. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518649 Share on other sites More sharing options...
stuart7398 Posted April 16, 2008 Author Share Posted April 16, 2008 no you won't be getting a donation. this not the military. you are little people like us and me who sit behind a desk. you are not high ranking, if so in what. typed letters from a keyboard. you are not the only forum. goodbye. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518653 Share on other sites More sharing options...
Daniel0 Posted April 16, 2008 Share Posted April 16, 2008 What are you? Like 10 years old? There is only a single person on this site who outrank me (the site owner, who by the way seldom interfere with any issue), so I am in my fullest right to respond and judge the situation, and I know fenway as being quite capable in regards to databases. On a related sidenote: This text might be useful for your further learning: "The Allegory of the Cave" by Plato. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518657 Share on other sites More sharing options...
stuart7398 Posted April 16, 2008 Author Share Posted April 16, 2008 Fenways first reply was "where's the join" If he had bothered reading the post he would have seen effort was made. I do not head my posts "helllllp" or anything similar. = EFFORT Hi. I think I have done a successful join, not sure. = GUIDANCE REQUIRED How would I join these 2 tables? Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518661 Share on other sites More sharing options...
stuart7398 Posted April 16, 2008 Author Share Posted April 16, 2008 do a little research and view all my posts. "helllllp" is not in my dictionary Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518664 Share on other sites More sharing options...
Daniel0 Posted April 16, 2008 Share Posted April 16, 2008 Indeed. And nobody is mocking you for that. When fenway asked "Where is the join?", it was a pointer to where the JOIN statement where. You could've then look at your query and you would've seen that there was no such thing. fenway's question also implied that there should be a such thing in the query. All you did however, was to respond in a harsh manner which would hardly trigger any further help. Also, please refrain from posting multiple posts after each other. I believe you say it yourself: You respond with one liners because you know little and are simply bumping up your 'post' scores. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518668 Share on other sites More sharing options...
fenway Posted April 16, 2008 Share Posted April 16, 2008 You've been warned... I strongly urge you to stop. If you'd like to frequent another forum, I'm sure you'll be dearly missed. LOCKED. Link to comment https://forums.phpfreaks.com/topic/101185-solved-join-shows-to-much-data/#findComment-518678 Share on other sites More sharing options...
Recommended Posts