Simple login Web services Using PHP


$jsonString = file_get_contents('php://input');
$jsonObj = json_decode($jsonString, true);
$data = $jsonObj;

if($data["mode"] == "login")
    {
$name=$data['username'];
$pass=$data['password'];
$query = "SELECT id,name FROM salseman where username='$name' and password='$pass' ";
$result = (mysql_query($query));
$arrResponse = array();
while($row = mysql_fetch_assoc($result))
{
$arrResponse[] = $row;
}


        if (!empty($arrResponse))
        {
       

$response = array(
                    "status" => 1,
                    "message" => "Success",
                    "response" => $arrResponse
                );
        }
        else
        {
          $response = array(
                    "status" => 0,
                    "message" => "No Data found",
"response" => $arrResponse
                );
        }
}

Post a Comment

Previous Post Next Post