title: php database connection not working from wordpress function
body: <p>I want to send form data from contact form 7 in WordPress to another database.</p>
  
  <p>I made a folder inside the child theme named CustomFunctions inside the folder I created 2 files custom.config.php and custom.functions.php and will going to access those files in functions.php in editor.</p>
  
  <p>code inside custom.config.php</p>
  
  <pre><code>// **************** database *************
  
  $db_host = "****";
  
  $db_name = "****";
  
  $db_user = "****";
  
  $db_word = "****";
  </code></pre>
  
  <p>code inside custom.functions.php</p>
  
  <pre><code>&lt;?php
  include_once 'custom.config.php';
  
  if (!$dbCustom = new mysqli_connect($db_host,$db_user,$db_word,$db_name));
  {
  
  die("0,There is a problem, please call the administrator");
  
  }
  function addLead($name,$telephone,$email,$details){
  
  global $dbCustom;
  
  $query ="INSERT INTO enquiries(account_id,enquiry_name,enquiry_email,enquiry_phone,enquiry_details) VALUES(0,'$name','$email','$telephone','$details);");
  
  mysqli_query($dbCustom,$query);
  
  }
  </code></pre>
  
  <p>And this code I inserted at functions.php.</p>
  
  <pre><code>include_once '/CustomFunctions/custom.functions.php';
  add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
  
  function my_theme_enqueue_styles() 
  {
      wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
  }
  
  add_action('wpcf7_before_send_mail', 'save_form' );
  
  
  function save_form( $wpcf7 ) 
  {
      global $dbCustom;
      $submission = WPCF7_Submission::get_instance();
  
      if ( $submission ) 
      {
          $submited = array();
          $submited['posted_data'] = $submission-&gt;get_posted_data();
      }
  
      $name = $submited['posted_data']['text-890'];
      $email = $submited['posted_data']['text-199'];
      $comment = $submited['posted_data']['email-306'];
      $details = $submited['posted_data']['additional'];
  
      addLead($name,$telephone,$email,$details);
  
  };
  </code></pre>
  
  <p>these are my contact form fields</p>
  
  <p>I only want these first 4 fields.</p>
  
  <pre><code>[text* text-890 placeholder "Full Name*"]
  [text* text-199 placeholder "Telephone*"]
  [email* email-306 placeholder "Email*"]
  [textarea additional placeholder "Additional Information"]
  [recaptcha class:captcha size:compact]
  [submit "Send"]
  [hidden hidden-109 id:Venue "post_title"]
  </code></pre>
  
  <p>Afer I tried to send the form. the data was sent to the email but did not sent the data to the other database which is my goal. and there was no signs of errors</p>