将变量插入表中

时间:2009-09-28 06:10:06

标签: php

我可以在以下代码中生成activation_key。但我无法将其插入表中。空值插入表中。 我究竟做错了什么? (使用PEAR文本密码和其他扩展名)

                $activation_key = Text_Password::createFromLogin($data['email'], 'rot13');
                $sql = "INSERT INTO auth (firstname, lastname,gender,dob,mobileno,landlineno,addressline1,addressline2,addressline3,country,state,city,pincode,email,username,password,question,answer,activation_key)
                VALUES ('" . $db->escapeSimple($data['firstname']) . "','"
                                    . $db->escapeSimple($data['lastname'])."','"
                                    . $db->escapeSimple($data['gender'])."','"
                                    . $db->escapeSimple($data['dob'])."','"
                                    . $db->escapeSimple($data['mobileno'])."','"
                                    . $db->escapeSimple($data['landlineno'])."','"
                                    . $db->escapeSimple($data['address1'])."','"
                                    . $db->escapeSimple($data['address2'])."','"
                                    . $db->escapeSimple($data['address3'])."','"
                                    . $db->escapeSimple($data['country'])."','"
                                    . $db->escapeSimple($data['state'])."','"
                                    . $db->escapeSimple($data['city'])."','"
                                    . $db->escapeSimple($data['pin'])."','"
                                    . $db->escapeSimple($data['email'])."','"
                                    . $db->escapeSimple($data['username'])."','"
                                    . md5($db->escapeSimple($data['pwd']))."','"
                                    . $db->escapeSimple($data['question'])."','"
                                    . $db->escapeSimple($data['answer']). "', '"
                                    . $db->escapeSimple($data['activiation_key'])."')";
          $db->query($sql);

1 个答案:

答案 0 :(得分:2)

$data['$activiation_key']实际上似乎没有$activation_key

加上如果你真的剪切和粘贴,那么$activiation_key拼写错误