I have spent all night trying various different ways to connect my .php script to my localhost server, but I'm having no luck. I tried copying the socket script from MAMP homepage, and have also tried to use a script I found in another article on here, as well as a Youtube tutorial, but with no success.
It is a simple login form, which renders as it should on my webpage, but when I submit a form to the DB, no entries are made in the users table.
As I am very new to PHP I am out of ideas for what I believe should be a simple task. I will post the code below hopefully someone can see my error.
dbh.php:
<?php 
$conn = mysqli_connect("localhost", "root", "root", "authentication", "8889");
 if(!conn) {
die("Failed: " . mysqli_connect_error());
}
?> 
signup.php:
<?php 
        include 'dbh.php';
        $uid = $_POST['uid'];
        $pwd = $_POST['last'];
        $pwd_again = $_POST['pwd_again'];
        #echo $first."<br>";
        #echo $last."<br>";
        #echo $uid."<br>";
        #echo $pwd ."<br>";
        $sql = "INSERT INTO user (uid, pwd, pwd_again) VALUES ('$uid', '$pwd' '$pwd_again')";
        $result = mysql_query($conn, $sql); 
        echo "<script type='text/javascript'>  window.location='main.php'; </script>";
        ?>
index.php:
<!DOCTYPE html>
    <html>
        <head>
        <?php include 'dbh.php';
     ?>
        </head> 
        <body>
    <div id="signUp">
        <form action="signup.php" method="POST">
            <input type="text" name="uid" placeholder="Username"><br>
            <input type="Password" name="pwd" placeholder="Password"><br>
            <input type="Password" name="pwd_again" placeholder="Confirm Password"><br>
            <button type="submit">Register</button>
         </form>
    </div>
        </body>
    </html>
Does anyone know what it could be?
