1

SQL Query:

INSERT INTO probid_users 
(username, password, email, reg_date, payment_mode, balance, max_credit, salt, tax_account_type, tax_company_name, tax_reg_number, tax_apply_exempt, name, address, city, country, state, zip_code, phone, birthdate, birthdate_year, newsletter, pg_paypal_email, pg_worldpay_id, pg_checkout_id, pg_nochex_email, pg_ikobo_username, pg_ikobo_password, pg_protx_username, pg_protx_password, pg_authnet_username, pg_authnet_password, pg_mb_email, pg_paymate_merchant_id, pg_gc_merchant_id, pg_gc_merchant_key, pg_amazon_access_key, pg_amazon_secret_key, pg_alertpay_id, pg_alertpay_securitycode, pg_gunpal_id, first_name, last_name, pg_account_number, pg_account_holder_name, pg_account_holders_number, pg_bank_name, pg_bank_code, pg_paypal_percent_fee, pg_paypal_flat_fee ) 
VALUES 
('42685', '**181e6bd87b116b270bef7c308fd2afdb**', '[email protected]', **1368979346**, **2**, '-5', '5.00', 'dc1', '0', '', '', '0', 'vv fvf', 'fvfvf', 'fvfv', '2083', '2173', '4262', '28823625', '1986-01-01', '1986', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'vv', 'fvf', '', '','', '', '')

Where is the error? Is between ????*?

1
  • 1
    it sounds like you have too many or too little values, have you cross counted? Commented May 19, 2013 at 17:20

3 Answers 3

1

Your "INSERT INTO" part of your query specifies 50 columns but your "VALUES" only specifies 48. You could add two more blank string values to even it out.

INSERT INTO probid_users (username, password, email, reg_date, payment_mode, balance, max_credit, salt, tax_account_type, tax_company_name, tax_reg_number, tax_apply_exempt, name, address, city, country, state, zip_code, phone, birthdate, birthdate_year, newsletter, pg_paypal_email, pg_worldpay_id, pg_checkout_id, pg_nochex_email, pg_ikobo_username, pg_ikobo_password, pg_protx_username, pg_protx_password, pg_authnet_username, pg_authnet_password, pg_mb_email, pg_paymate_merchant_id, pg_gc_merchant_id, pg_gc_merchant_key, pg_amazon_access_key, pg_amazon_secret_key, pg_alertpay_id, pg_alertpay_securitycode, pg_gunpal_id, first_name, last_name, pg_account_number, pg_account_holder_name, pg_account_holders_number, pg_bank_name, pg_bank_code, pg_paypal_percent_fee, pg_paypal_flat_fee ) 
VALUES ('42685', '181e6bd87b116b270bef7c308fd2afdb', '[email protected]', 1368979346, 2, '-5', '5.00', 'dc1', '0', '', '', '0', 'vv fvf', 'fvfvf', 'fvfv', '2083', '2173', '4262', '28823625', '1986-01-01', '1986', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'vv', 'fvf', '', '','', '', '', '', '')
Sign up to request clarification or add additional context in comments.

Comments

1

I'm not going to count all of those fields to make sure they're, but the problem might be that '' in SQL is a way to escape '. Instead of using '' for an empty string, try \'\' or '''' . Confusing, I know.

Comments

1

Your column count doesn't match your value count.

To prevent this in the future:

If there is the possibility that there is no value (probably all fields with an empty string '' in your query), you should add the option that a certain column can be NULL.

CREATE TABLE tbl(
    field1 int NULL /* INSTEAD OF NOT NULL */
)

Null means you don't know the value yet or there is no value. Then you would be able to execute a statement like this:

INSERT INTO probid_users 
(username, password, email, reg_date, payment_mode, balance, max_credit, salt, tax_account_type, tax_apply_exempt, name, address, city, country, state, zip_code, phone, birthdate, birthdate_year, newsletter, pg_paypal_email, pg_account_number, pg_account_holder_name) 
VALUES 
('42685', '**181e6bd87b116b270bef7c308fd2afdb**', '[email protected]', **1368979346**, **2**, '-5', '5.00', 'dc1', '0', '', '', '0', 'vv fvf', 'fvfvf', 'fvfv', '2083', '2173', '4262', '28823625', '1986-01-01', '1986', 'vv', 'fvf')

If you only insert available and not all values, you can prevent mistakes like this in the future.

BTW: You should also take a look at database normalization (https://en.wikipedia.org/wiki/Database_normalization)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.