Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $dbuser = "root";
- $dbpassword = "";
- $dbname = "wwm";
- // Creates the connection and check if it sucessfully connected.
- try
- {
- $conn = new PDO("mysql:host=$host;dbname=$dbname", $dbuser, $dbpassword);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- echo 'Connected to Database';
- }
- catch(PDOException $e)
- {
- echo $e->getMessage();
- }
- ?>
- <?php
- include 'connect.php';
- //So this code will run if user did submit the form:
- if (!empty($_POST))
- {
- $statement = $conn->prepare("INSERT INTO users(first_name, sur_name, email, password, role, region, survey) VALUES (:fname, :lname, :email, :password', :role, :region, :survey)");
- $statement->bindParam(':fname', $_POST['fname']);
- $statement->bindParam(':lname', $_POST['lname']);
- $statement->bindParam(':email', $_POST['email']);
- //do i use mb5 for password, or is there another way to increase password security?
- $statement->bindParam(':password', md5($_POST['password']));
- $statement->bindParam(':role', $_POST['role']);
- $statement->bindParam(':region', $_POST['region']);
- $statement->bindParam(':survey', $_POST['survey']);
- $statement->execute();
- }
- ?>
- Here are one of the errors i keep getting:
Add Comment
Please, Sign In to add comment