Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Register form won't connect

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 367
    Answer it

    Can some one please help with a register form for a website? I can't get it to load information to database.

    prepare($query); $statement->bind_param('ssssissiisss', $firstname, $lastname, $streetAddress, $suburb, $postcode, $state, $country, $phone, $mobile, $email, $dateJoined, $password); $statement->execute(); $statement->store_result(); $creationWasSuccessful = $statement->affected_rows == 1 ? true : false; if ($creationWasSuccessful) { $userId = $statement->insert_id; $addToUserRoleQuery = "INSERT INTO users_in_roles (user_id, role_id) VALUES (?, ?)"; $addUserToUserRoleStatement = $db->prepare($addToUserRoleQuery); // this puts all users into standard user role. in other websites there may be different levels of access $userRoleId = 2; $addUserToUserRoleStatement->bind_param('dd', $userId, $userRoleId); $addUserToUserRoleStatement->execute(); $addUserToUserRoleStatement->close(); //$_SESSION['userid'] = $userId; )this is not being used here -- header has session include //$_SESSION['username'] = $username; ) if removed? do we need else function? // header ("Location: home.php"); ) } else { echo "Failed registration"; /*? do we need this ?*/ } } include ("includes/header.php"); ?>




    First Name  
    Last Name  
    Reenter Password  
    Street Address  


    By registering, you agree to comply with the Australian Lightning Club Terms and conditions



 1 Answer(s)

  • Hello,

    I just checked your mentioned code. You are using different user data in a form and trying to insert the details in database. In this first step should be connection making to database. Have you made the connection from database?. If you make the mistake in query syntax then you can simply use the phpmyadmin for proper query. Let me know if you need any other help.

    Regards Deepak Verma

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: