When connecting, it gives errors and did not understand what is wrong here, like the correct syntax.

` Notice: Undefined index: log in /opt/lampp/htdocs/tech_user/con_data_ajax/connect_ajax_data_users.php on line 6 Notice: Undefined index: login in /opt/lampp/htdocs/tech_user/con_data_ajax/connect_ajax_data_users.php on line 12 ` 

FILE WHERE THIS ERROR

  <?php include ('database/connect_my_admin.php'); //header('Access-Control-Allow-Origin: *'); $answer = '{"id":"0", "name":"xxx"}'; if(($_GET['log']=="tech_user") AND ($_GET['pasw']=="111")){ mysqli_query($connect, "SELECT tab_1 SET pass='111',login='tech_user' WHERE id='1'"); echo '{"id":"1", "name":"Копыча"}'; } if(($_GET['login']=="tech_user") AND ($_GET['pass']=="222")){ mysqli_query($connect, "SELECT tab_1 SET pass='222',login='tech_user' WHERE id='2'"); echo '{"id":"2", "name":"Порхун"}'; } ?> 

    1 answer 1

    It's simple. The $_GET array does not contain values ​​with the log and login keys.

    To find out what it contains, you can output the entire array with the var_dump($_GET) command var_dump($_GET)

    If these parameters are optional, the code should take this into account.

     if (isset($_GET['log']) && ($_GET['log']=="tech_user") && ($_GET['pasw']=="111")){ 

    Or for PHP 7

     if ((($_GET['log'] ?? '')=="tech_user") && ($_GET['pasw']=="111")){