php - Session variables only sets once the page has been refreshed -
Once the page is loaded once, my session variable changes only to the right value. This behavior is weird Due to the fact that the second session variable (michide) is set correctly for the first time that the page is loading. If the variable that is not installed correctly (the review number), this code is set to the bottom of the snippet.
Code
I'm sorry Long code snippet, though I do not know where the error is:
If ($ stmt = $ dbc- & gt; Prepare (select "Machid, User 1, User 2, User 1 acceptor, user 2 acceptable matches WHERE user1_accept =? Or user2_accept =? LIMIT 1")) {$ stmt - & gt; Tie-on ('ii', $ id, $ id); Bind the ID for the // parameter $ Stmt-> Executed (); // Execute the prepared query. $ Stmt- & gt; Store_result (); // Get the variable with the result $ Stmt-> Bind_salt ($ michid, $ user1, $ user2, $ user1_accept, $ user2_accept); $ Stmt- & gt; Bring (); $ Num_rows = mysqli_stmt_num_rows ($ stmt); If ($ num_rows == 0) {header ('location: /nomatches.php')}} $ _SESSION ['machid'] = $ michid; } Print_r ($ _ session); If ($ user1! = $ Id) {echo 'user1! = '; $ Reviewnumber = 'user2_accept'; Echo $ reviewnumber; If ($ stmt = $ dbc- & gt; Ready ("SELECT aboutme, buddy, imageprofile WHERE id =? LIMIT 1")) {$ stmt-> Bind_param ('i', $ user1); Bind the ID for the // parameter $ Stmt-> Executed (); // Execute the prepared query. $ Stmt- & gt; Store_result (); // Get the variable with the result $ Stmt-> Bind_salt ($ aboutme, $ friend, $ picture); $ Stmt- & gt; Bring (); $ Image = intestine ('/', array_map ('crude leancode', explosion ('/', $ image));} ($ stmt = $ dbc- & gt; (Where "Choose the fullname name id =? Bind $ id = $ stmt- & gt; bind_param ('i', $ user1); // parameter execute ($) execute (); // execute the query. $ Stmt Get the variable from -> store_result (); // result get $ stmt-> bind_result ($ FULL_NAME); $ stmt-> fetch ();}} if ($ user2! = $ Id) {echo 'User2! ='; $ Reviewnumber = 'user1_accept'; resonance $ reviewnumber; if ($ stmt = $ dbc-> ready ("SELECT aboutme, friend, Id, userprofile WHERE id =? LIMIT 1 ")) {$ stmt- & gt; bind_param ('i', $ user2); // bind id for parameter $ stmt- & gt; executed (); // ready Execute the variable from $ Stmt- & gt; store_result (); // Get results from $ Stmt- & gt; Bind_salt ($ aboutme, $ buddy, $ image); $ Stmt- & gt; bring (); $ Image = intestine ('/', array_map ('crude leancode', explosion ('/', $ image));} ($ stmt = $ dbc- & gt; Prepare (choose "user WHOE id =? LIMIT 1")) {$ stmt-> Bind_param ('i', $ user2); Bind the ID for the // parameter $ Stmt-> Executed (); // Execute the prepared query. $ Stmt- & gt; Store_result (); // Get the variable with the result $ Stmt-> Bind_result ($ FULL_NAME); $ Stmt- & gt; Bring (); }} $ _SESSION ["review number"] = $ review number; Variable: reviewnumber, resonates correctly on the first page load, which is why I do not understand why session variables are not set correctly.
itemprop = "text" If someone has a similar problem, then checking it is definitely an important thing.
Comments
Post a Comment