Delete from table one row with 2 variable with limit


I’m developing a PHP script who store session of users in a Database.

When an user logout from server, remove only one row ( because same user can login more than one time )

When server reboot, remove all session of all users from that server with same ip.

Table structure:

  • Table name:
    • totalconcurrent
  • Column in table:
    • ID [int, autoincrement, 11]
    • serverip [mediumint]
    • userid [text]

Running on :

mysql  Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64) using readline 5.1 

Case: User logout

Query runs correctly but doesn’t delete anything.

    elseif ($  _GET['status'] == "logout"){         $  sql = "DELETE FROM totalconcurrent WHERE (serverip,userid) IN ((INET_ATON('".get_server_ip()."'),'".$  _GET['id']."')) LIMIT 1;";         if ($  conn->query($  sql) === TRUE) {             echo "1 Session of ".$  _GET['id']." removed";         } else {             echo "Error: " . $  sql . "<br>" . $  conn->error;         }     } 

Case: Server Reboot

Query runs correctly but doesn’t delete anything.

    elseif ($  _GET['status'] == "reboot"){         $  sql = "DELETE FROM totalconcurrent WHERE serverip IN ((INET_ATON('".get_server_ip()."')));";          if ($  conn->query($  sql) === TRUE) {             echo "Server rebooted, removed all session stored in this server";         } else {             echo "Error: " . $  sql . "<br>" . $  conn->error;         }     } 

Problem:

I’ve tryed many times and many types of query to do this but without finding the correct way to do this.

What queries i need for do this?