Hello,
I need some help with PHPMaker 9 "Server Events".
trying to do a simple filter but my lack of knowledge of PHP & Mysql is getting me in a jam.
I have 2 tables:
MyMainTable = which has all individual records for different people
and
Users = the security table that also has a "Cities" field with single quote-comma delimited city names.
What I need to do is to filter the MyMainTable to only display authorized cities records from the "Users" table.
The server event I have going on right now is:
// Recordset Selecting event
function Recordset_Selecting(&$filter) {
ew_AddFilter($filter, "`MyMainTable`.`City` IN (" . CurrentUserInfo("Cities") . ")");
}
The killer of the whole thing is that I had this running the other night and thought I backed up what I did to "Code Repository" but goofed. I know the server event above has an error. I may have added "Users" before or in CurrentUserInfo("Cities") . ")"); somewhere but I forget exactly what I did.
Errors I am getting are:
Failed to execute SQL: SELECT * FROM `MyMainTable` WHERE `MyMainTable`.`City` IN () LIMIT 20 OFFSET 0. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 20 OFFSET 0' at line 1
No records found
(mysqlt): SET NAMES 'utf8'
Error (0):
(mysqlt): SELECT COUNT(*) FROM `MyMainTable` WHERE `MyMainTable`.`City` IN ()
Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
(mysqlt): SELECT * FROM `MyMainTable` WHERE `MyMainTable`.`City` IN ()
Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
(mysqlt): SELECT * FROM `MyMainTable` WHERE `MyMainTable`.`City` IN () LIMIT 20 OFFSET 0
Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 20 OFFSET 0' at line 1
Thanks in advance for any replies!
Art