Lv-Kris Posted January 29, 2007 Share Posted January 29, 2007 Hello.I've came across a need to connect my `users` tables `user_id` with the same `user_id` from `user_stuff` table. Ive been reading about InnoDB and is this the case I should use it? Ive tried the phpMyAdmin function `link tables` but it doesn't seem to work. Well i could write the `user_id` in all the tables needed upon registering, but, as i suppose, it will cause more server workload and loose efficiency.Thank You for any advice.Kris Link to comment https://forums.phpfreaks.com/topic/36205-connecting-user_id-in-different-tables/ Share on other sites More sharing options...
bibby Posted January 30, 2007 Share Posted January 30, 2007 Lv-Kris you can select from multiple tables almost as if they are one.[code]select users.user_name, user_stuff.stuffisfrom users, user_stuffwhere user.user_id = user_stuff.user_id and user.userid=1[/code]shortened by aliases, but the same[code]select u.user_name , s.stuffisfrom users u , user_stuff swhere u.user_id = s.user_idand u.user_id =1[/code]Joins are great too.If you want to use joins , the ref page is here[url=http://dev.mysql.com/doc/refman/5.1/en/join.html]http://dev.mysql.com/doc/refman/5.1/en/join.html[/url] Link to comment https://forums.phpfreaks.com/topic/36205-connecting-user_id-in-different-tables/#findComment-172588 Share on other sites More sharing options...
fenway Posted January 30, 2007 Share Posted January 30, 2007 Joins are actually better... comma operator is evil. Link to comment https://forums.phpfreaks.com/topic/36205-connecting-user_id-in-different-tables/#findComment-172947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.