stewart715 Posted October 21, 2006 Share Posted October 21, 2006 ok i have a form where person either selects privacy mode (which is a value of 1) or public mode (where it is a value of 2)..when submitted it is placed into a database called privacy mode with a column UID (which inputs the persons UID and a privacyid which inputs the selction they made.I need a profile template to select that table based on that persons UID to see whether they chose 1 (which is private mode) or 2 (public mode)..if they chose 2..they can show the profile because its public mode but if they chose 1 i want the profile to check a 'buddylist' table to see if the person viewing has their user ID in the column 'buddy' next to the persons profile which their trying to viewings 'UID' (in the same row of course)Example.. buddy PERSON A has a UID of 2..PERSON B has a UID of 4PERSON A pics privacy so the table 'privacymode' hasUID privacyid2 1PERSON B is trying to view PERSON A's profile so since PERSON A picked 1 for their privacyid the page checks buddy list for:UID buddy2 4In a nutshell:i want it to do the query and then have it return a function if their is a relationship or if the privacyid is set to 2 (public mode) elsereturn this function insteadI'm guessing I'd use INNER JOIN but how would i do this? Link to comment https://forums.phpfreaks.com/topic/24628-help-with-inner-join/ Share on other sites More sharing options...
corbin Posted October 21, 2006 Share Posted October 21, 2006 I dont think you would need an inner join at all just add a privacyid column to your users table and a buddy list table and the php to handle them. Link to comment https://forums.phpfreaks.com/topic/24628-help-with-inner-join/#findComment-112184 Share on other sites More sharing options...
stewart715 Posted October 21, 2006 Author Share Posted October 21, 2006 well, someone on this site told me to do this:[code]$sql = "SELECT p.* FROM profile p INNER JOIN privacymode pr ON p.UID = pr.UID LEFT JOIN buddylist b ON p.UID = b.UID AND b.buddy = '$userid' WHERE p.UID = '$profileid' AND ((b.UID IS NOT NULL) OR (pr.privacyid = 2) )";[/code]which would work I think, however, I don't want it to pull the profile data from a table like it is..i want it to simply return a certain function if it's true and return a different function if falsein very very very ignorant terms lol:$query = the above.if true..return function Aelsereturn function B Link to comment https://forums.phpfreaks.com/topic/24628-help-with-inner-join/#findComment-112185 Share on other sites More sharing options...
stewart715 Posted October 21, 2006 Author Share Posted October 21, 2006 Help :( Please Link to comment https://forums.phpfreaks.com/topic/24628-help-with-inner-join/#findComment-112196 Share on other sites More sharing options...
fenway Posted October 22, 2006 Share Posted October 22, 2006 I don't know what you mean by "return a function" for DB query. Link to comment https://forums.phpfreaks.com/topic/24628-help-with-inner-join/#findComment-112779 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.