Question about onValidate Event

Hi to All,

I have created an authentication system following the template Training. Of course, I had to modify some tables.
In the event onValidate of login control, I have as part this code:

sc_lookup(ds_user_app, "select tb_groups_x_apps.app_name from tb_groups_x_apps 
inner join tb_users_x_groups on tb_groups_x_apps.group_id = tb_users_x_groups.group_id where 
tb_users_x_groups.user_full_name = $glo_username ");

if ({ds_user_app} === false)
{
echo "Access error. Message=". {ds_user_app_erro} ;
}
elseif (empty({ds_user_app}))
{
echo "Select command didn't return data";
}

The part of coloured code is used for the test of query and the global variable $glo_username was declared previous.
When I execute the login control, this error is returned

Access error. Message=Unknown column ‘Admin’ in ‘where clause’

I have tried to execute the query in the Toad for mySQL, with this change

SELECT tb_groups_x_apps.app_name
  FROM    tb_groups_x_apps
       INNER JOIN
          tb_users_x_groups
       ON tb_groups_x_apps.group_id = tb_users_x_groups.group_id
 WHERE tb_users_x_groups.user_full_name = 'Admin'

The query work fine and the list of column app_name is correctly returned.
Can someone help me ? Have You any idea?

Hi Gaetano

You just have to put quotes around the variable $glo_username like …user_full_name = ‘$glo_username’ ");

Thanks, solved

Hi,
did you try yet to substiture $glo_username with ‘$glo_username’ ?