tags:

views:

54

answers:

1

Hi, I am able to generate the activation_key in the following code. But I can't manage to insert it into the table. Blank value gets inserted into the table. What am I doing wrong? (using PEAR text password and other extensions)

                $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);
+2  A: 

$data['$activiation_key'] doesn't actually appear to hold $activation_key

plus if you really cut and paste then $activiation_key is spelt wrongly

Scott Evernden
Thanks. 1) corrected the spelling2) Changed the line to something like this... .$db->escapeSimple($activation_key)."')";And it solved the problem. Is it ok to use vi or should I use something else to improve my coding time?
shantanuo
nothing wrong w/ vi - i used that for years and years, for php coding these days i tend to use eclipse, and notepad++ on Windows
Scott Evernden