Bo Kamphues

11
reputation
3

About me

I'm sixteen years old and in love with coding stuff. I've been trying to learn everything from the internet and books I can find. I've been working towards this goal since I was very young. Coding and computers are awesome and I hope to learn a lot from you all! I currently have a job at a Dutch Virtual Reality company called WemakeVR. We make 360 degrees video's in virtual reality. Check it out at wemakevr.com.

Currently working on

I'm currently working on trying to get a simple HTML form into a database and learning all about databases and the PHP that comes with that.

<?php
        if ($_POST){
        $servername= 'localhost';
        $username = 'root';
        $password = 'passwords';

        $connection = mysql_connect($servername, $username, $password);

        if (!$connection) {
            die("Connection failed: " . mysql_connect_error());
            echo "Oops!"
        }

        mysql_select_db("database_project", $connection);

        $firstname = $_POST['firstname'];
        $lastname = $_POST['lastname'];
        $sex = $_POST['sex'];
        $password = $_POST['password'];
        $confirm_password = $_POST['confirm_password'];
        $email_address = $_POST['email_address'];
        $confirm_email_address = $_POST['confirm_email_address'];

        $firstname = mysql_real_escape_string($firstname);
        $lastname = mysql_real_escape_string($lastname);
        $sex = mysql_real_escape_string($sex);
        $password = mysql_real_escape_string($password);
        $email_address = mysql_real_escape_string($email_address);

        $sql = "INSERT INTO 'database_project' . 'users' ('userid', 'firstname', 'lastname', 'sex', 'password', 'email_address') VALUES (NULL, '$firstname', '$lastname', '$sex', '$password', '$email_address');"; 

        mysql_query($query);

        echo '<script language="Javascript">alert("User was successfully created.");</script>';
        mysqli_close($connection);
        }
?>