t.bo Posted February 7, 2010 Share Posted February 7, 2010 Hey all, Currently I have 3 different websites that are administrated for 90% on their own. The other 10% are the user tables. I wanted to make sure the user can register 1 time for 3 websites and have one profile for the 3 websites. So I created views for 2 websites user tables. These are now linked to the tables of the first website. This way al that I wanted works...except for one thing. In the user table there is one field called avatar. This field is responsible for the picture each user has. I want it to be possible to have all fields shared over the 3 websites except this field. This way the user can have different avatars for each website. So basically my question is: Can I create views for just one field? OR Can I create a view for a table and exclude 1 field from that table to function on it's own? Kind regards, Thibaut Quote Link to comment https://forums.phpfreaks.com/topic/191278-create-views-on-fields/ Share on other sites More sharing options...
Mchl Posted February 7, 2010 Share Posted February 7, 2010 Yes and yes, and you can also move avatar information to another table altogether and link it to user profile in 1 to many relationship. Quote Link to comment https://forums.phpfreaks.com/topic/191278-create-views-on-fields/#findComment-1008549 Share on other sites More sharing options...
t.bo Posted February 8, 2010 Author Share Posted February 8, 2010 That's great news. Thank you for your reply Mchl. Now, at the moment I did a CREATE VIEW for the whole table. If I delete and recreate the one 'avatar' field in the 'slave' table, will this work? I mean is this the correct way to exclude one field from the view? Kind regards, thibaut Quote Link to comment https://forums.phpfreaks.com/topic/191278-create-views-on-fields/#findComment-1008744 Share on other sites More sharing options...
Mchl Posted February 8, 2010 Share Posted February 8, 2010 I don't exactly understand what you mean. You can create a view from most simple (i.e. without subqueries) SELECT statements. Quote Link to comment https://forums.phpfreaks.com/topic/191278-create-views-on-fields/#findComment-1008754 Share on other sites More sharing options...
t.bo Posted February 8, 2010 Author Share Posted February 8, 2010 Well I already created a view for the whole table like this CREATE VIEW lvn_users AS SELECT * FROM dbk_users In the lvn_users table there is a field called 'avatar'. So my question is how do I exclude this field from the current view? Do I just drop the field and recreate it or do I need to drop the whole table 'lvn_users' and do something else? greets Quote Link to comment https://forums.phpfreaks.com/topic/191278-create-views-on-fields/#findComment-1008762 Share on other sites More sharing options...
Mchl Posted February 8, 2010 Share Posted February 8, 2010 CREATE VIEW lvn_users AS SELECT allFieldsExceptAvatar FROM dbk_users Quote Link to comment https://forums.phpfreaks.com/topic/191278-create-views-on-fields/#findComment-1008768 Share on other sites More sharing options...
t.bo Posted February 8, 2010 Author Share Posted February 8, 2010 Ok I have tried this. However now ofc there is no avatar field anymore in the slave table. I also cannot create a normal extra field 'Avatar'. That means the user cannot have an avatar in the slave site. So I guess if you create a view for one or more fields, that counts for the whole table... :-( Thanks tho for the help! Quote Link to comment https://forums.phpfreaks.com/topic/191278-create-views-on-fields/#findComment-1008870 Share on other sites More sharing options...
Mchl Posted February 8, 2010 Share Posted February 8, 2010 You need to create a view based on JOIN of your user table and a table with avatars for 'slave' site. Quote Link to comment https://forums.phpfreaks.com/topic/191278-create-views-on-fields/#findComment-1008883 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.