else $msg="You failed to achieve this raffle. Try Again next week"; } else{ $sql="INSERT INTO kid_raffles VALUES(DEFAULT,:raffle_id,:kid_id,:kid_answer,:status,NOW())"; $sth=$conn->prepare($sql); $sth->bindValue('kid_id',$kid); $sth->bindValue('raffle_id',$raffle_id); $sth->bindValue('kid_answer',$answer); $sth->bindValue('status',$status); try{$sth->execute(); $success='1'; $msg='Raffle Answered'; if($status) DataClass::AddBadge($kid,'raffle'); } catch(Exception $e){} } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+ /*if($success=='1'){ echo json_encode(array("success"=>$success,"msg"=>$msg,"data"=>$data));
if(count($result)){ $success='1'; $msg="Already Connected"; } else{ $sql="INSERT into friends(id,kid_id1,kid_id2,status,created_on) VALUES(DEFAULT,:kid1,:kid2,1,NOW())"; $sth=$conn->prepare($sql); $sth->bindValue("kid1",$kid1); $sth->bindValue("kid2",$kid2); try{$sth->execute(); $success='1'; $msg="Kids Connected"; DataClass::AddBadge($kid1,'friend'); DataClass::AddBadge($kid2,'friend'); } catch(Exception $e){} } } else{ $success='0'; $msg="Wrong Buddy Code"; } } else{ $success='0';