I have a table of users and I'm trying to run a query to get the last user_id added to the table. I get an error. Here's the code:
    $connect = mysqli_connect("localhost","adhude","windows","photodb");
    // Check connection
    if(!$connect){
      die("connection failed :"+ mysqli_connect_errno());
    }else{
      function NewUser(){
        $sql = "INSERT INTO user (User_Name, Password) VALUES  ('".$_POST["Email"]."','".$_POST["psw"]."')";
        $result=mysqli_query($GLOBALS['connect'],$sql);
        if($result){
          echo "<script> alert('Records added successfully')</script>";
          GetUserId();
        }else {
          echo "<script> alert('Records not added ')</script>";
        }
      }
      //function to get the last added user id
      function GetUserId(){
        $sql="SELECT * FROM user ORDER BY User_Id DESC LIMIT 1";
        $result=mysqli_query($GLOBALS['connect'],$sql);
        if (!$result) {
          echo 'Could not run query: ' . mysql_error();
          exit;
          }
        $arrayResult = mysql_fetch_array($result);
        $Latest_User=$arrayResult['User_Id'];
      }
I'm getting the following error
Fatal error: Uncaught Error: Call to undefined function mysql_fetch_array() in C:\xampp\htdocs\web2\php\signup_process.php:165 Stack trace: #0 C:\xampp\htdocs\web2\php\signup_process.php(148): GetUserId() #1 C:\xampp\htdocs\web2\php\signup_process.php(203): NewUser() #2 C:\xampp\htdocs\web2\php\signup_process.php(214): SignUp() #3 C:\xampp\htdocs\web2\pages\signup.php(14): include('C:\xampp\htdocs...') #4 {main} thrown in C:\xampp\htdocs\web2\php\signup_process.php on line 165
165 has the following code :   $arrayResult = mysql_fetch_array($result);
 
     
    