【发布时间】:2013-03-09 22:31:45
【问题描述】:
$stmt = $conn->prepare("INSERT INTO user VALUES ('',:username,md5(:password),'',1,'','',:email,'',0,0,'',:cover,:dateofbirthYear:dateofbirthMonth:dateofbirthDay,NOW(),:sex,:country)");
$stmt->execute(array(
':username' => $username,
':password' => $password,
':email' => $email,
':cover' => $cover,
':dateofbirthYear' => $dateofbirthYear,
':dateofbirthMonth' => $dateofbirthMonth,
':dateofbirthDay' => $dateofbirthDay,
':sex' => $sex,
':country' => $country
));
由于某种原因,此插入语句不起作用。我是 PDO 的新手,所以我不太了解它。我做错了什么?
这个语句给了我这个错误:
致命错误:未捕获的异常“PDOException”和消息“SQLSTATE [HY093]:无效的参数号:绑定变量的数量与/home/manga/public_html/new/register.php:80 中的令牌数量不匹配”堆栈跟踪:
#0 /home/manga/public_html/new/register.php(80): PDOStatement->execute(Array)
#1 {main} 在第 80 行的 /home/manga/public_html/new/register.php 中抛出
【问题讨论】:
-
“我已经在 stackoverflow 上查找了错误”您是否尝试过自己考虑一下?
-
@feeela 如果我没有,我为什么要把问题放在这里?
-
你真的应该 not be using
md5到 hash passwords。