This topic is locked
[SOLVED]

 Many to Many Relation and Access Level

10/15/2012 6:59:24 AM
PHPRunner General questions
T
Tayyab Ilyas author

If someone can help me in this please.
I have two tables

Table1: User (UserID(PK), UserRole, Name, Phone)- User role can be admin, client, agent

Table2: Claims(ClaimID(PK) , UserID(FK), ClaimDetails)
Clients can submit 1-n claims
Admin can assign these claims to agents from User table and one claim can be assigned to multiple agents.

to achieve this i have created a talbe

Table3: Claimtousermapping(UserID,ClaimID)
Now i have created a view AgentClaim with InnerJoin of Claim & Claimtousermapping to list all claims related to agents and in advance security settings i have set it to : users can see and edit their own data only.
In inner join (Claimtousermapping)i have Claimtousermapping.UserID as AgentID
The problem is when i edit any data from agent view i get following error
<<< Record was NOT edited >>>

Unknown column 'Claimtousermapping.userID' in 'where clause'
Can anyone help me in this. Thanks in advance.

Best Regards,

T
Tayyab Ilyas author 10/15/2012

Thanks all i solved the issue. To help others:
I have added below code to Event List Page:Before SQL Query and changed advance security to user can edit and see other users data
$strWhereClause = whereAdd($strWhereClause,"claimtousermapping.userID='".$_SESSION["UserID"]."'");