nicholasolsen Posted March 16, 2011 Share Posted March 16, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/230862-friend-request-script-with-an-error-hidden-somewhere-i-cant-find-help-please/ Share on other sites More sharing options...
nicholasolsen Posted March 17, 2011 Author Share Posted March 17, 2011 If someone could take a look at the code i entered above i would really appreciate it. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/230862-friend-request-script-with-an-error-hidden-somewhere-i-cant-find-help-please/#findComment-1188689 Share on other sites More sharing options...
fife Posted March 17, 2011 Share Posted March 17, 2011 put or die (mysql_error()); here mysql_query($query) or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/230862-friend-request-script-with-an-error-hidden-somewhere-i-cant-find-help-please/#findComment-1188708 Share on other sites More sharing options...
nicholasolsen Posted March 17, 2011 Author Share Posted March 17, 2011 I figured out what the problem was. It was a variable that didnt recieve its value on a different page, and therefore the value didnt show up in the mysql table.. Thanks for the reply fife. Quote Link to comment https://forums.phpfreaks.com/topic/230862-friend-request-script-with-an-error-hidden-somewhere-i-cant-find-help-please/#findComment-1188727 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.