Issue with echoing session vartiables

Something is up and I cant figure out what.
I created a control with two fields, Login and Password
On the On Validate event I have this.

$slogin = sc_sql_injection({Login});
$spswd = sc_sql_injection(({Password}));

$sql = "SELECT
sec_lvl,
CONCAT(first_name,’ ',last_name),
email,
schoolid,
userid
FROM users
WHERE login = $slogin
AND password = ".$spswd;

sc_lookup(rs, $sql);

if(count({rs}) == 0)
{
sc_log_add(‘login Fail’, {lang_login_fail} . {login});
sc_error_message({lang_error_login});
}
else if(count({rs}) >=1)
{
[groupid] = {rs[0][0]};
[usr_name] = {rs[0][1]};
[usr_email] = {rs[0][2]};
[schoolid] = {rs[0][3]};
[userid] = {rs[0][4]};

}

echo"name=" . [usr_name];
exit;

But it wont echo. I cant get any of these variables to echo out.

Under Global Variables, the [usr_name] variable is set to Session and Type=Out.

It’s something embarrassingly obvious I know it… any ideas?

first of all c_sql_injection(({Password})); has double (), not sure if that causes any issues.
second, it’s a good practice not to use echo’s. Depending on your application flow the text will be overwritten, refreshed, or (on ajax event) ignored. Best approach is to use the log module of scriptcase and send the text into the log module (macro). Then you can look into your database to see what happened. You can also write a small library function to write to a sequential file. Ie.\


function outputDebugString($log) {
$dt="
".date('Y-m-d H:i:s').' |';
$rv=@file_put_contents('./log_'.date("j.n.Y").'.log', $dt.$log, FILE_APPEND | LOCK_EX);
}

The double () was the trick.
Why wouldn’t that throw an error?
Thanks Albert… I will look into this Log Module

Aducom… when I run this:
outputDebugString($log); What do I use as $log?

Anything you like. Your echo:

echo"name=" . [usr_name];

would have to be changed to

outputDebugString(“name=” . [usr_name]);

It would result in an outputfile

log_20180104.log with content

20180104 20:12:01 | <your text>