I have a grid that pulls data from a single table and I need to check the data in another table and determine if the user has the required training.
Table 1 - user
Table 2 - user_training
Grid 1 pulls the data out of the user’s table
user_id
user_name
I’ve manually added the following fields to the grid
skill_1
I’ve placed the following code into a PHP method
$check_sql = ‘SELECT user_id, training’
. ’ FROM user_training’
. " WHERE user_id = ‘" . {user.member_id} . "’ AND training = ‘4’ ";
sc_select(rs, $check_sql);
//initialize the field
{skill_1} = ‘No’;
if (false == {rs}) // Error while accessing database
{
sc_error_message(‘Error while accessing database.’);
}
else
{
while(!$rs->EOF)
{
{skill_1} = ‘Yes’;
$rs->MoveNext();
}
$rs->Close();
};
This code works fine until I have 2 or more conditions to add.
I’m trying to figure out how to make it consider multiple conditions for the code.
An example, I need skill_1 to be Yes if training = 4, 12, 17, and 22.
If the user has any combo if training other than those four I need it be return No.
Anyone point me in the right direction?