if (!($uid && $kid2 && $code)) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { $sql = "SELECT * from users where id=:id and is_deleted=0"; $sth = $conn->prepare($sql); $sth->bindValue('id', $uid); try { $sth->execute(); } catch (Exception $e) { } $res = $sth->fetchAll(PDO::FETCH_ASSOC); if (count($res)) { //$kid1=DataClass::getkidId($code,$uid); $kid1 = DataClass::getkidIdFromCode($code); if ($kid1 != $kid2) { if ($kid1) { $sql = "SELECT * from friends where kid_id1 IN (:kid1,:kid2) and kid_id2 IN (:kid1,:kid2)"; $sth = $conn->prepare($sql); $sth->bindValue("kid1", $kid1); $sth->bindValue("kid2", $kid2); try { $sth->execute(); } catch (Exception $e) { } $result = $sth->fetchAll(); if (count($result)) { $success = '1'; $msg = "Already Connected"; if ($grownup) {