title: mysqli error - bind_param: number of variables doesn't match
body: <p>I am getting the following error but I have counted things over and over again and everything appears to be fine. Anyone have any ideas on it ?</p>
  
  <p>Error:</p>
  
  <blockquote>
    <p><b>Warning</b>:  mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of
    variables doesn't match number of parameters in prepared statement in
    <b>/home/ambnews/public_html/invoice/response.php</b> on line
    <b>204</b><br /></p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>// invoice customer information
      // billing
      $customer_name = $mysqli-&gt;real_escape_string($_POST['customer_name']); // customer name
      $customer_email = $mysqli-&gt;real_escape_string($_POST['customer_email']); // customer email
      $customer_address_1 = $mysqli-&gt;real_escape_string($_POST['customer_address_1']); // customer address
      $customer_address_2 = $mysqli-&gt;real_escape_string($_POST['customer_address_2']); // customer address
      $customer_town = $mysqli-&gt;real_escape_string($_POST['customer_town']); // customer town
      $customer_county = $mysqli-&gt;real_escape_string($_POST['customer_county']); // customer county
      $customer_postcode = $mysqli-&gt;real_escape_string($_POST['customer_postcode']); // customer postcode
      $customer_phone = $mysqli-&gt;real_escape_string($_POST['customer_phone']); // customer phone number
  
      //shipping
      $customer_name_ship = $mysqli-&gt;real_escape_string($_POST['customer_name_ship']); // customer name (shipping)
      $customer_address_1_ship = $mysqli-&gt;real_escape_string($_POST['customer_address_1_ship']); // customer address (shipping)
      $customer_address_2_ship = $mysqli-&gt;real_escape_string($_POST['customer_address_2_ship']); // customer address (shipping)
      $customer_town_ship = $mysqli-&gt;real_escape_string($_POST['customer_town_ship']); // customer town (shipping)
      $customer_county_ship = $mysqli-&gt;real_escape_string($_POST['customer_county_ship']); // customer county (shipping)
      $customer_postcode_ship = $mysqli-&gt;real_escape_string($_POST['customer_postcode_ship']); // customer postcode (shipping)
  
      $query = "INSERT INTO store_customers (
                      name,
                      email,
                      address_1,
                      address_2,
                      town,
                      county,
                      postcode,
                      phone,
                      name_ship,
                      address_1_ship,
                      address_2_ship,
                      town_ship,
                      county_ship,
                      postcode_ship
                  ) VALUES (
                      '".$customer_name."',
                      '".$customer_email."',
                      '".$customer_address_1."',
                      '".$customer_address_2."',
                      '".$customer_town."',
                      '".$customer_county."',
                      '".$customer_postcode."',
                      '".$customer_phone."',
                      '".$customer_name_ship."',
                      '".$customer_address_1_ship."',
                      '".$customer_address_2_ship."',
                      '".$customer_town_ship."',
                      '".$customer_county_ship."',
                      '".$customer_postcode_ship."'
                  );
              ";
  
      /* Prepare statement */
      $stmt = $mysqli-&gt;prepare($query);
      if($stmt === false) {
        trigger_error('Wrong SQL: ' . $query . ' Error: ' . $mysqli-&gt;error, E_USER_ERROR);
      }
  
      print_r($stmt-&gt;bind_param(
          'sssssssissssss',
          $customer_name,$customer_email,$customer_address_1,$customer_address_2,$customer_town,$customer_county,$customer_postcode,
          $customer_phone,$customer_name_ship,$customer_address_1_ship,$customer_address_2_ship,$customer_town_ship,$customer_county_ship,$customer_postcode_ship));
  
      /* Bind parameters. TYpes: s = string, i = integer, d = double,  b = blob */
      $stmt-&gt;bind_param(
          'sssssssissssss',
          $customer_name,$customer_email,$customer_address_1,$customer_address_2,$customer_town,$customer_county,$customer_postcode,
          $customer_phone,$customer_name_ship,$customer_address_1_ship,$customer_address_2_ship,$customer_town_ship,$customer_county_ship,$customer_postcode_ship);
  
      /* Execute statement */
      $stmt-&gt;execute();
  
      if($stmt-&gt;execute()){
          //if saving success
          echo json_encode(array(
              'status' =&gt; 'Success',
              'message' =&gt; 'Customer has been created successfully!'
          ));
      } else {
          // if unable to create invoice
          echo json_encode(array(
              'status' =&gt; 'Error',
              'message' =&gt; 'There has been an error, please try again.'
              // debug
              //'message' =&gt; 'There has been an error, please try again.&lt;pre&gt;'.$mysqli-&gt;error.'&lt;/pre&gt;&lt;pre&gt;'.$query.'&lt;/pre&gt;'
          ));
      }
  
      //close database connection
      $mysqli-&gt;close();
  </code></pre>