This topic is locked

edit OTHERS data, but NOT own data

9/27/2009 9:11:35 AM
PHPRunner General questions
W
wfcentral author

I know this sounds weird, but I have to create a view where a person can see and edit everyone else's data, but NOT their own. Since this isn't available in the permissions area I'm trying to create a query that will only pull the data that is NOT theirs.
tbl_owners (id, club_ID, password, name)

tbl_clubs (id, club_ID, name, location, features)
So, I have to pull all tbl_clubs where "club_ID" is NOT equal to the club currently logged in... they login using their club_ID...
thanks,

Robert

K
KevinMillican 9/27/2009



I know this sounds weird...


It should be fairly straightforward to create a view that excludes a user's own data.

However, I wonder if that's really what you need, rather than a linked table so that people can add additional comments related to another club ?

W
wfcentral author 9/27/2009

it's hard to explain, but I do already have linked tables and multiple views going on for several different levels of users.
The last part I need to finish is for one view I want to show all records that are NOT owned by the person logged in... just don't know how to do it...



It should be fairly straightforward to create a view that excludes a user's own data.

However, I wonder if that's really what you need, rather than a linked table so that people can add additional comments related to another club ?

J
Jane 9/28/2009

Hi,
use List page: Before SQL query event on the Events tab for this purpose.

Here is a sample:

$strWhereClause = whereAdd($strWhereClause,"club_ID!=".$_SESSION["club_ID"]."");


You can fill $_SESSION["club_ID"] in the AfterSuccessfulLogin event.

W
wfcentral author 9/29/2009

I'm getting this error
Fatal error: Function name must be a string in /home/ugn/public_html/admin/membership-Gyms/include/tbl_members_events.php on line 215
here's what I did...
After successful login
(added) $_SESSION['club_ID'] = $data['id'];
List page: Before SQL query
(added) $strWhereClause = whereAdd($strWhereClause,"gym_ID!=".$_SESSION("club_ID")."");
I checked to make sure that line was correct by replacing it temporarily with this one
$strWhereClause = whereAdd($strWhereClause,"gym_ID!="1020"");
which works just fine for testing, but since I have to get this number unique to login I can't hard code it.



Hi,
use List page: Before SQL query event on the Events tab for this purpose.

Here is a sample:

$strWhereClause = whereAdd($strWhereClause,"club_ID!=".$_SESSION["club_ID"]."");


You can fill $_SESSION["club_ID"] in the AfterSuccessfulLogin event.

W
wfcentral author 9/29/2009

my mistake...
I was using $_SESSION() instead of $_SESSION[]



I'm getting this error
Fatal error: Function name must be a string in /home/ugn/public_html/admin/membership-Gyms/include/tbl_members_events.php on line 215
here's what I did...
After successful login
(added) $_SESSION['club_ID'] = $data['id'];
List page: Before SQL query
(added) $strWhereClause = whereAdd($strWhereClause,"gym_ID!=".$_SESSION("club_ID")."");
I checked to make sure that line was correct by replacing it temporarily with this one
$strWhereClause = whereAdd($strWhereClause,"gym_ID!="1020"");
which works just fine for testing, but since I have to get this number unique to login I can't hard code it.

W
wfcentral author 9/29/2009

okay, I got it working now... but it killed the "no records on the first page" that I had checked in the Misc area... all records show up on the first page.

J
Jane 9/30/2009

Hi,
try to use this code:

$strWhereClause = whereAdd($strWhereClause,"gym_ID!=".$_SESSION["club_ID"]."");

if(!count($_GET) && !count($_POST))

$strWhereClause = whereAdd($strWhereClause,"1=0");