r0adra93 Posted March 29, 2011 Share Posted March 29, 2011 I am working on creating an actionhook to insert data into a database shared by multiple hosting accounts. The code works, however, as soon as the shared hosting account is created I recieve an error message stating "Service ID Not Found". I am thinking that maybe this error occures from a conflict due to the opening of two seperate databases, maybe I am wrong. I just need some additional tips here. Thanks! Here is my code: function generate_variables($vars) { $tri_systemurl = "http://" . $vars['params']['domain'] . "/"; $tri_afflink = "?aff=" . $vars['params']['clientsdetails']['userid']; $tri_afflinkamp = "&aff=" . $vars['params']['clientsdetails']['userid']; $tri_db_info['username'] = "<REMOVED>"; $tri_db_info['password'] = "<REMOVED>"; $tri_db_info['host'] = "localhost"; $tri_db_info['dbname'] = "<REMOVED>"; $tri_db_info['connection'] = mysql_connect($tri_db_info['host'], $tri_db_info['username'], $tri_db_info['password']) or die(mysql_error()); $tri_query = "INSERT INTO sites VALUES('0','$tri_systemurl','$tri_afflink','$tri_afflinkamp');"; @mysql_db_query($tri_db_info['dbname'], $tri_query, $tri_db_info['connection']); mysql_close($tri_db_info['connection']); } add_hook("AfterModuleCreate",1,"generate_variables"); 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted March 30, 2011 Share Posted March 30, 2011 Your actually quite correct... it is the DB issue. You need to reconnect to the whmcs DB after you close your external one. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.