此代码给我这个错误:参数号无效:绑定变量数与令牌数不匹配
$fields[':email']=$_GET["email"];
$fields[':password']=$_GET["password"];
$fields[':telefono']=$_GET["telefono"];
$fields[':old_email']=$_GET["old_email"];
$fields[':isAdmin']=0;
$qry.="UPDATE utente SET Email:=email, Password:=password ,Telefono:=telefono, isAdmin=:isAdmin WHERE Email=:old_email";
$sth=$CONNESSIONE->prepare($qry);
$sth->execute($fields);
字段的var_dump打印此
array(5){[“:email”] => string(5)“test2”[“:password”] => string(1)“b”[“:telefono”] => string(7)“0415600”[“:old_email”] => string(4)“test”[“:isAdmin”] => int(0)}
我的表就是这个
CREATE TABLE IF NOT EXISTS `utente` (
`Email` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`Password` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`Telefono` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`isAdmin` tinyint(1) NOT NULL,
UNIQUE KEY `Email` (`Email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
为什么这不起作用?
答案 0 :(得分:6)
更改此
$qry.="Email:=email, Password:=password ,Telefono:=telefono, isAdmin=:isAdmin WHERE Email=:old_email";
到
$qry.="Email=:email, Password=:password ,Telefono=:telefono, isAdmin=:isAdmin WHERE Email=:old_email";
您在:
=