Force connection to a given database from app_Login

Your application starts connecting to the conn_mysql_DB1 database.

When you use more than one database connection and the user closes unexpectedly (close the browser tab) and the session variables stay with the database connection: conn_mysql_DB2, but your login must always connect to mysql_DB1 in the form general sends you errors in app_Login.

FORCE FROM LOGIN:
To correct this, modify app_login in the event:

OnScriptInit:

sc_reset_apl_status();
sc_reset_global([checked_array]);
sc_reset_global([usr_login], [usr_email],[glo_nm_conexao]);
$_SESSION[“scriptcase”][“app_Login”][“glo_nm_conexao”] = ‘conn_mysql_DB1’;
for ($i = 1; $i <= 2; $i++) {
sc_reset_change_connection();
sc_change_connection(‘conn_mysql_DB2’,‘conn_mysql_DB1’);
}

This procedure processes twice (sc_change_connection) forcing to connect to the first connection you need.

In this case conn_mysql_DB1

I hope it helps you, any questions contact me ceo@edifact.com.mx