Как правильно это реализовать?
require_once '../engine/config.php';
require_once '../engine/db.php';
header('Content-TYPE: application/json');
if(empty($_GET['name'])){echo 'error';}
if(empty($_GET2['password'])){echo 'error';}
else {
$query = mysqli_query($connection, ("SELECT * FROM `users` WHERE `name`='".$_GET['name']."'"));
$query2 = mysqli_query($connection, ("SELECT * FROM `users` WHERE `password`='".$_GET2['password']."'"));
$result = mysqli_fetch_assoc($query, $query2);
if($result) {
$result = array(
'name' => $result['name'],
'tgdays' => $result['tgdays'],
'hwid' => $result['hwid']
);
echo json_encode($result);
}
else{
echo 'error';
}
}