Пример #1
0
            $sth->execute();
        } catch (Exception $e) {
        }
        $result = $sth->fetchAll();
        if (count($result)) {
            $sql = "update friends set status=1 where kid_id2=:kid and buddy_key=:code";
            $sth = $conn->prepare($sql);
            $sth->bindValue("kid", $kid);
            $sth->bindValue("code", $code);
            try {
                $sth->execute();
                $success = '1';
                $msg = "Status Updated";
            } catch (Exception $e) {
            }
            $data = DataClass::get_buddy_details($kid, $code) ? DataClass::get_buddy_details($kid, $code) : [];
        } else {
            $success = '0';
            $msg = "No Result Found";
        }
    } else {
        $success = '0';
        $msg = "Invalid User";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == '1') {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {