Mysql错误输出:列计数不';不匹配第1行的值计数

Mysql错误输出:列计数不';不匹配第1行的值计数,mysql,sql,row,Mysql,Sql,Row,SQL查询: 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, bir

SQL查询:

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**', 'jose_jamo@hotmail.com', **1368979346**, **2**, '-5', '5.00', 'dc1', '0', '', '', '0', 'vv fvf', 'fvfvf', 'fvfv', '2083', '2173', '4262', '28823625', '1986-01-01', '1986', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'vv', 'fvf', '', '','', '', '')
错误在哪里?介于??*

查询的“插入”部分指定了50列,但“值”仅指定了48列。您可以再添加两个空白字符串值来平衡它

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', 'jose_jamo@hotmail.com', 1368979346, 2, '-5', '5.00', 'dc1', '0', '', '', '0', 'vv fvf', 'fvfvf', 'fvfv', '2083', '2173', '4262', '28823625', '1986-01-01', '1986', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'vv', 'fvf', '', '','', '', '', '', '')

我不打算计算所有这些字段以确保它们是正确的,但问题可能是SQL中的“”是一种转义方式。请尝试\'\'或''',而不是将''用于空字符串。令人困惑,我知道。

您的列计数与您的值计数不匹配

为防止今后发生这种情况:

如果可能没有值(可能是查询中所有字段都有空字符串“”),则应添加特定列可以为
NULL
的选项

CREATE TABLE tbl(
    field1 int NULL /* INSTEAD OF NOT NULL */
)
Null表示您还不知道该值或没有值。然后您将能够执行如下语句:

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**', 'jose_jamo@hotmail.com', **1368979346**, **2**, '-5', '5.00', 'dc1', '0', '', '', '0', 'vv fvf', 'fvfvf', 'fvfv', '2083', '2173', '4262', '28823625', '1986-01-01', '1986', 'vv', 'fvf')
如果只插入可用值而不是所有值,则可以防止将来出现类似错误


顺便说一句:您还应该看看数据库规范化()

听起来您的值太多或太少,是否交叉计算过?