I need some help with my code, When I click the submit code it always says "User successfully kicked". However, the query is not executed successfully, the user is still in the database.
edit: Fixed mysql/msqli problem. Query now answers "Something went wrong" in stead of "User successfully kicked". But I wont get any errors from the mysql_error report. What could I do?
include 'connect.php';
if(empty($_POST['user_id'])) 
    {
            echo '<form method="post" action="">
                  User_id: <input type="text" name="user_id" />
                 <input type="submit" value="Kick user" />
                 </form>';
    }
    else 
    {
        $sql = "DELETE FROM users
                WHERE 
                user_id = '" .mysqli_real_escape_string($_POST['user_id']) . "'
                ";
        $result = mysqli_query($con, $sql);
        if($result)
        {
            //something went wrong, display the error
            echo 'Something went wrong!.';
            echo mysqli_error(); //debugging purposes, uncomment when needed
        }
        else
        {
            echo 'User successfully kicked!';
        }
    }
My connect.php looks like this:
<?php
$con=mysqli_connect ("localhost","root","","dps");
if (mysqli_connect_errno()) {
echo "failed to connect mysql: ". mysqli_connect_error();
}
?>
 
     
     
    