Jump to content

Friend-request script with an error hidden somewhere i cant find... Help please


nicholasolsen

Recommended Posts

 

Im working on a "Friend-request"-script, but something is wrong in my "answer"-script...

 

See the script below:

 

    if (isset($_POST['submit_ansReq_answer'])) {
    
        $answer = $_POST['ansReq_what'];
        $uid= $_SESSION['userid'];
        $fid= $_POST['fid'];
        
        
        $db=friend_db;
        $dbname=bannaky_basic;
        include('config.php');
        
        
        ///////////// IF ACCEPTED
        
        if ($answer == "acceptReq") {
        
        $reqStat = "YES";
        $reqEcho = "Answered YES";
        
        }
    
        ///////////// ELSE IF DENIED
    
        else if ($answer == "denyReq") {
        
        $reqStat = "NO";
        $reqEcho = "Answered NO";
        
        }
        
        $query = "UPDATE $db SET req_accept='$reqStat' WHERE friend_id='$uid' AND user_id='$fid'";
            
            mysql_query($query);
            
            
            echo "$reqEcho";

 

 

If the user hits the Accept-button, everything works fine and is registered in the SQL database. But when hitting the Deny-button nothing happens... I get to the page and $regEcho works, but $reqStat=NO; wont save in the SQL database...

 

Probably a simple solution to this that im not seeing.... Please help me out before i loose my mind.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.