示例#1
0
 $sth->bindValue('email', $email);
 try {
     $sth->execute();
 } catch (Exception $e) {
 }
 $res = $sth->fetchAll();
 $uid2 = $res[0]['id'];
 $apnid = $res[0]['apn_id'];
 if (count($res)) {
     if ($uid == $uid2) {
         $success = '0';
         $msg = "Both Users are same";
     } else {
         //fetching all kids of that user
         if ($kid[0] == -1) {
             $kid = DataClass::get_kids_New($uid, $uid2);
         }
         foreach ($kid as $val) {
             $sql = "select * from connect where user_id1=:user_id1 and user_id2=:user_id2 and kid_id=:kid_id";
             $sth = $conn->prepare($sql);
             $sth->bindValue('user_id1', $uid);
             $sth->bindValue('user_id2', $uid2);
             $sth->bindValue('kid_id', $val);
             try {
                 $sth->execute();
             } catch (Exception $e) {
             }
             $res[$key] = $sth->fetchAll();
             if (!count($res[$key])) {
                 $sql = "INSERT INTO `connect` (`id`, `user_id1`, `user_id2`,`kid_id`,`code`,`status`,`is_deleted`,`created_on`,`update_on`) VALUES (DEFAULT, :user_id1, :user_id2, :kid_id, :code, 0,0,NOW(),NOW())";
                 $sth = $conn->prepare($sql);