尝试在数据库php mysql中输入值时出错

I tried to insert into a mySQL database using PHP. I am using XAMPP server, and the way to the project i am working on is in htdocs/proiect

the php code is

if($ok == 0){
        $hostname = "localhost";
        $database = "Forum";
        $db_table = "Users";
        $db = mysql_connect('localhost', 'root','');
        mysql_select_db($database,$db);
        $sql = "INSERT INTO $db_table(name,email) values (nvl(select max(user_id) from Users,0)+1,'".mysql_real_escape_string(stripslashes($_REQUEST['userTxt']))."','".mysql_real_escape_string(stripslashes($_REQUEST['passTxt'])) ."','".mysql_real_escape_string(stripslashes($_REQUEST['emailTxt']))."',sysdate,'A')";
        if($result = mysql_query($sql ,$db)) {
            echo '<h1>Thank you</h1>Your information has been entered into our database<br><br>';
        } else {
            echo "ERROR: ".mysql_error();
        }
    }

the error I get is

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'select max(user_id) from Users,0)+1,'cdscs','as','csdcsd',sysdate,'A')' at line 1

the table is

hei