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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.