No-Server Posted November 12, 2010 Share Posted November 12, 2010 Hello, when I use function extreme_premium_ClientArea($params) { # ** The variables listed below are passed into all module functions ** $serviceid = $params["serviceid"]; # Unique ID of the product/service in the WHMCS Database $pid = $params["pid"]; # Product/Service ID $producttype = $params["producttype"]; # Product Type: hostingaccount, reselleraccount, server or other $domain = $params["domain"]; $username = $params["username"]; $password = $params["password"]; $clientsdetails = $params["clientsdetails"]; # Array of clients details - firstname, lastname, email, country, etc... $customfields = $params["customfields"]; # Array of custom field values for the product $conxxfigoptions = $params["configoptions"]; # Array of configurable option values for the product $fullname = $clientsdetails["firstname"] . " " . $clientsdetails["lastname"]; # Product module option settings from ConfigOptions array above $steamid = $customfields["SteamID"]; $steamid = strip_tags($steamid); $conxx = mysql_connect("xxxxxxxx","xxxxxxxx","xxxxxxxxx"); if (!$conxx) { die('Could not connect: ' . mysql_error()); } mysql_select_db("roleplay_rpdb", $conxx); $resultxx = mysql_query("SELECT * FROM `players` WHERE `_SteamID` = '" . $steamid . "'"); $rowxx = mysql_fetch_array($resultxx); <some **** defined> mysql_close($conxx); $code = ' <table width="100%" cellspacing="0" cellpadding="0" class="frame"> <tr> <td><table width="100%" border="0" cellpadding="10" cellspacing="0"> <tr> <td width="150" class="fieldarea">Premium valid until:</td> <td><font color="' . $cellcol . '">' . $datevalid . '</font></td> </tr> <tr> <td width="150" class="fieldarea">Premium valid for:</td> <td>' . $hisname . ' [steamID: ' . $steamid . ']</td> </tr> </table></td> </tr> </table>'; return $code; } I get Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\inetpub\vhosts\ideal-hosting.biz\subdomains\billing\httpdocs\includes\dbfunctions.php on line 0 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\inetpub\vhosts\ideal-hosting.biz\subdomains\billing\httpdocs\includes\dbfunctions.php on line 0 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\inetpub\vhosts\ideal-hosting.biz\subdomains\billing\httpdocs\includes\dbfunctions.php on line 0 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\inetpub\vhosts\ideal-hosting.biz\subdomains\billing\httpdocs\includes\dbfunctions.php on line 0 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\inetpub\vhosts\ideal-hosting.biz\subdomains\billing\httpdocs\includes\dbfunctions.php on line 0 It's only in the client area code section... 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted November 13, 2010 Share Posted November 13, 2010 Looks like you're not specifying the correct password. 0 Quote Link to comment Share on other sites More sharing options...
No-Server Posted November 13, 2010 Author Share Posted November 13, 2010 What? I do. Otherwise I wouldn't get a result from the server. The problem is if I leave the code like this the downloads don't show anymore. 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted November 13, 2010 Share Posted November 13, 2010 The downloads probably are not showing because there are errors in your script (you posted them). The errors seem to indicate that your password is incorrect. Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\inetpub\vhosts\ideal-hosting.biz\subdomains\billing\httpdocs\includes\dbfunctions.php on line 0 0 Quote Link to comment Share on other sites More sharing options...
No-Server Posted November 13, 2010 Author Share Posted November 13, 2010 Why would it be incorrect. It is getting the correct values from the db so I guess it isn't incorrect. Also, I am not even using mysql_real_escape_string here. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted November 14, 2010 Share Posted November 14, 2010 You are connecting to another database, selecting that connection, getting the info and then closing the database connection. That leaves no connection to the database open as when you connected to the other DB the whmcs connection was closed. You need to reconnect again back to the whmcs db Just after you close the db connection add this to reconnect to the whmcs db global $db_host,$db_username,$db_password,$db_name;$whmcssql = mysql_connect($db_host,$db_username,$db_password); mysql_select_db($db_name,$whmcssql) or die("Could not connect to the database"); 0 Quote Link to comment Share on other sites More sharing options...
No-Server Posted November 14, 2010 Author Share Posted November 14, 2010 Thanks, works great 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted November 15, 2010 Share Posted November 15, 2010 You are connecting to another database, selecting that connection, getting the info and then closing the database connection.That leaves no connection to the database open as when you connected to the other DB the whmcs connection was closed. You need to reconnect again back to the whmcs db Just after you close the db connection add this to reconnect to the whmcs db Nice trick. I haven't tried to connect to another database from within WHMCS, but this makes complete sense. I'll add it to my list of tricks. Thanks 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted November 15, 2010 Share Posted November 15, 2010 You are both welcome. 0 Quote Link to comment Share on other sites More sharing options...
No-Server Posted November 15, 2010 Author Share Posted November 15, 2010 This should be added to the documentation Edit: Also added it to all the other things like _Create... etc. and now everything works correct again and it doesn't show weird errors like 'ID not found' anymore! Thanks! 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted November 15, 2010 Share Posted November 15, 2010 A couple of links that may help you http://php.net/manual/en/function.mysql-connect.php http://www.php.net/manual/en/function.mysql-select-db.php http://www.php.net/manual/en/function.mysql-close.php 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.