Grid link does not pick up current data

I have a grid that lists clients. I have a button (HTML Image) at the end of each row that when clicked picks up the client data and takes me to a blank application that uses that client info to change the connection to that client’s data. Well it is supposed to.

The command goes

sc_connection_edit(“conn_mysql”,$arr_conn);

I have confirmed the data is the client login data.

I then try to access a table in the client database using

sc_lookup(ad,“SELECT gi_account, gi_bsb, gi_name FROM general_info WHERE gi_id = 1”,“conn_mysql”);

But it actually gets the data from the “default” database not the client database. I then issue a message that says there was a problem, and send me back to the grid, and then the next time I click on the link, it works OK.

So, why would sc_connection_edit(“conn_mysql”,$arr_conn); not work the first time?

Answers or workarounds all welcome.

Thanks
Tony

Thanks