sql select user level

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
robdwalsh
User
Posts: 7

sql select user level

Post by robdwalsh »

At the moment I have a data base where I am using dynamic user levels. in the user table I create the user, login details and user level. this in turn is used to populate 3 other tables with the users name. what I am having to do is after I generate every the code with php maker is alter by hand every select statement to include WHERE userlevel = 2 or 3 or 4 depending on what the user level is. is there anyway to do this in phpmaker without having to do this by hand for every table?


danielc
User
Posts: 1601

Post by danielc »

You do not need to alter by hand to change select statement. See Server Events and Client Scripts in help file.


Webmaster
User
Posts: 9430

Post by Webmaster »

You can specify a dynamic table/lookup table filter based on user level. The format is a SQL WHERE statement. For example: "<Field> = " & CurrentUserLevel()

For table level filter, use the [Tables] -> [Filter] setting. For lookup table filter, use [Fields] -> [Lookup Table] -> [Filter].


robdwalsh
User
Posts: 7

Post by robdwalsh »

Hi thanks for the reply,

forgive my ignorance but I do not understand where I need to put the select statement.


robdwalsh
User
Posts: 7

Post by robdwalsh »

is this the correct way to alter the userID_filetring?

// User ID Filtering event
function UserID_Filtering(&$filter) {
"SELECT id_Users FROM users WHERE level = 2" ;
}


robdwalsh
User
Posts: 7

Post by robdwalsh »

resolved finally worked it out by using the filter on the lookup table then drag level into filter editor and add =2 or what ever level the table requires


Webmaster
User
Posts: 9430

Post by Webmaster »

NOTE the correct syntax for UserID_Filtering is:

// User ID Filtering event
function UserID_Filtering(&$filter) {
filter = "<new filter>";
}


Post Reply