I cant able to Update my users table from different college table which is present in another main database. But my query running successfully on mysql but when I am trying to execute query using PHP it cant able to update the user database from the college database
    UPDATE users 
     SET 
     student_name = ( SELECT main.college.Student_Name
                       FROM main.college
                       WHERE main.college.Enroll_No =  '123456'
                       LIMIT 1 ) 
      WHERE user_id =5
Above query successfully running on phpmyadmin. But in PHP cant able to Update the user table
<?php
         require_once('dbConnect.php');
            $sql = "UPDATE users \n"
                    . "\n"
                    . "SET \n"
                    . "\n"
                    . "student_name = ( SELECT main.college.Student_Name\n"
                    . " FROM main.college\n"
                    . "WHERE main.college.Enroll_No = '123456'\n"
                    . "LIMIT 1 ) \n"
                    . "WHERE user_id =5";
                   if(mysqli_query($con,$sql)){
                             mysqli_query($con,$sql);
                             echo 'successfully registered';
            }else{
                echo 'oops! Please try again!';
            }
     mysqli_close($con);
?>
 
    