php - Insert into not creating new row -


i've been trying mess around registration system. when try insert information database. no new row generated. i'm not getting errors, , code seems legitimate. there don't know insert into?

$username = $_post['regusername']; $email = $_post['regemail']; $password = $_post['regpassword']; $cpassword = $_post['regpasswordcon']; $firstname = $_post['regfirstname']; $lastname = $_post['reglastname']; //check username weird symbols if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $username)){     // 1 or more of 'special characters' found in string     //header("location: /register.php");     echo "your username should contain letters , numbers";     exit; }  //check if username taken $check = $con->prepare("select * accounts username=:user"); $check->bindparam(':user',$username); $check->execute(); $result = $check->fetch(pdo::fetch_assoc);  if(!empty($result)){     //header("location: /register-page.php"); //direct browser sign in     echo "user taken";     exit; }else{ //otherwise proceed register new user      //hashing of password     $hpassword = password_hash($password, password_default);      //prepared statements sql injection prevention     $query = $con->prepare("insert accounts (username, password, email, firstname, lastname) values (:name,:hpassword,:email,:fname,:lname) ");      //bind parameters     $query->bindparam(':name',$username);     $query->bindparam(':hpassword',$hpassword);     $query->bindparam(':email',$email);     $query->bindparam(':fname',$firstname);     $query->bindparam(':lname',$lastname);     $query->execute(); } 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -