This topic is locked

Unknown column '?ID' in 'where clause'

12/8/2014 12:17:05 PM
PHPRunner General questions
B
bencroftweb author

Hi
I keep getting this error when logged in as a non admin user (i.e. can only see records where the ID matches) and trying to save an edited record.
Unknown column 'Client.FranchiseID' in 'where clause'
I use the FranchiseID to determine the displayed records.
If I log in as a admin user I have no issues.
Help!
Thanks
Ben

Admin 12/9/2014

After some investigation we found that this table has 'Users can see and edit their own data only' security option applied with field from joined table selected as an OwnerID (Client.FranchiseID). This kind of setup won't work on the edit page as it requires a field from the main table (Site) to be selected as an OwnerID field.
There are two possible workarounds here

  1. Create a view in MySQL on the top of join SQL query. In this case any field can be selected as OwnerID field.
  2. Another option is to implement filtering via Dynamic SQL Query:

    http://xlinesoft.com/phprunner/docs/modify_sql_query_on_the_fly.htm