Thankyou提前回答了这个问题,这是我的代码的一部分,它不起作用。SQL语法错误,找不到原因
$sql_insert = "INSERT INTO 'users'
(
`ragionesociale`,
`user_name`,
`user_email`,
`pwd`,
`nome`,
`cognome`,
`tel`,
`tel2`,
`website`,
`date`,
`users_ip`,
`activation_code`,
`piva`,
`cf`,
`azienda`)
VALUES
(
'$data[ragionesociale]',
'$data[user_name]',
'$user_email',
'$sha1pass',
'$data[nome]',
'$data[cognome]',
'$data[tel]',
'$data[tel2]',
'$data[website]' ,
now(),
'$user_ip',
'$activ_code',
$data[piva],$data[cf],
$data[azienda])";mysql_query($sql_insert) or die("Insertion Failed:<br>$sql_insert<br>" . mysql_error());
,这是给定的结果:
INSERT INTO 'users' (
`ragionesociale`,
`user_name`,
`user_email`,
`pwd`,
`nome`,
`cognome`,
`tel`,
`tel2`,
`website`,
`date`,
`users_ip`,
`activation_code`,
`piva`,
`cf`,
`azienda`
)
VALUES (
'La Fabbrica dei Giochi',
'uuuuuuu',
'[email protected]',
'e258c8aac30eba143e1f3sssss6dc1cdc4d58ff1095',
'pietro',
'rossi',
'234234234',
'345.4346865',
'www.ssss.it' ,
now(),
'212.124.171.131',
'9962',
2323232,
tsssss6i819s,
1 )
错误消息:
You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near ''users'
(`ragionesociale`, `user_name`, `user_email`, `pwd`, `nome`, `cogno' at line 1
我找不到什么是错在此代码,我在浪费2小时... 。
在'users'上使用反引号而不是单引号,就像您为列操作一样。 – vee