I'm only a few days deep into zen cart, and php isn't exactly my strength either, but I need to add some stuff to my create_account.php and I'm unsure about the right 'zen syntax' and where to put files.

I'm using the dual pricing/wholesale mod (v1.3beta3) in my 1.3.7 install and I want to automate the assignment of the wholesale status based on data that's in another db on the same host/domain. So if a user is in the 'external db' -> wholesale status = 1, else = 0.

To do that, I'd want to use a small function, and use a separate config file for the connection info. Somewhat like this:

Code:
// my new function
function get_OtherDB_Data($user_inputData) {

// include connection info from file
require('includes/SOME SUB DIR/externalDB_config.php');

// these vars are actually in external config, not the function itself
// $ext_username = 'myusername';
// $ext_host = 'myhostname';
// $ext_DBpass = 'thePW';
// $ext_db_name = 'theDBname';

// make the connection to the 2nd db

   $db2 = mysql_connect($ext_host, $ext_username, $ext_DBpass, $ext_db_name) or die ('Unable to connect');
      
   $my_ext_data = $db2->Execute("SELECT xyz blah blah WHERE somedata = '" . $user_inputData . "'"); // syntax???

  if ($my_ext_data) { $whole_sale = 1; }
  else { $whole_sale = 0; }

  return $whole_sale;

}
Then in my create account.php, I'd just have to call my function and add my wholesale status info accordingly to the sql data array that inserts the form values into the customer table.

Again, where do I put the files and am I at least close? Any input is appreciated. I though I ask first before I break everything ... ;-)

Thanks,
Andrea