当我从移动设备上调用PHP Api时,服务器Ram已满

For a android app I create apis to get data from server. But server ram become full when I run my app. I follow this steps...

connection:

include("connection.php");
$mysqli->query("SET NAMES 'utf8'");

Query:

$sql1="SELECT ..."; 
$result1 = $mysqli->query($sql1);

Close Connection:

$mysqli->close();

One example of my queries:

 $sql1="SELECT user_id FROM user_table WHERE email like '$email'";  
 $result1 = $mysqli->query($sql1);
 if ($result1->num_rows > 0) {
    // output data of each row
   while($row = $result1->fetch_assoc()) {
     $user_id=$row["user_id"];
   }
}

Normally I select 20 to 50 rows from 100 to 200 rows.

Is there any problem of my code that can be responsible for ram overflow.

Thanks.