I am currently working trying to use the statements mysqli_prepare and bind_param in order to pass arguements more safely into my query. I was doing mysqli_query to execute them before which worked fine. My professor is requiring us to use prepare though. I currently am getting the proper values from my form but the data isn't being entered into customer table. Also, I have mysqli_error() on my execute() commands but I am not getting any errors at all which is making debugging difficult. Here is the php part located in register.php
<?php
    require 'connection.php';
    $result = "";
    if(isset($_POST['register'])) {
        #Fetch the data from the fields
        $username = $_POST['username'];
        $password = $_POST['password'];
        $name = $_POST['name'];
        $total = 0.0;
        #echo $username . " " . $password . " " . $name . " " . $total;
        #Prepare sql query to see if account already exists
        $query = mysqli_prepare("SELECT * FROM customer WHERE username=?");
        $query->bind_param("s", $username);
        $query->execute() or die(mysqli_error());
        if(mysqli_num_rows($query) > 0) {
            #This username already exists in db
            $result = "Username already exists";
        } else {
            $insert = mysqli_prepare("INSERT INTO customer(username, password, name, total) VALUES (?, ?, ?, ?)");
            $insert->bind_param("sssd", $username, $password, $name, $total);
            $insert->execute() or die(mysqli_error());
            #$result = "Account registered!"
        }
    }
 ?>
I establish connection to my db like this in connection.php
 $conn = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
Like I said before, I can get the query to execute with mysqli_query but for some reason I cannot get param to work. Also tried adding or die but no errors are being printed
 
    