loonie35 Posted October 31, 2008 Share Posted October 31, 2008 Hy! I started to learn PHP above month ago, i do not understand why this code always shows me the second result (echo "<input type='text' name='username' value='$username'>" even i have in database in column nick_change '+'. if($_SESSION['nick_change']== "-") { echo "<b>$username</b> [<a class='change_name' href='#'>Change username</a>]"; } else { echo "<input type='text' name='username' value='$username'>"; } Thanks for help! Link to comment Share on other sites More sharing options...
Jesdisciple Posted October 31, 2008 Share Posted October 31, 2008 If the nick_change column contains "+" then the behavior you described is correct because: '+' != '-' Link to comment Share on other sites More sharing options...
loonie35 Posted October 31, 2008 Author Share Posted October 31, 2008 but how to solve this problem? some example please? Link to comment Share on other sites More sharing options...
jeffman Posted October 31, 2008 Share Posted October 31, 2008 Are you calling session_start() in all the related scripts?Does one of your scripts actually assign "-" to $_SESSION['nick_change'] ?You might try var_dump ($_SESSION) just to see what's actually in there. Do it right after you call session_start() and then call exit.(Obviously, if this is an AJAX script, then your javascript end will have to alert the output.) Link to comment Share on other sites More sharing options...
Jesdisciple Posted October 31, 2008 Share Posted October 31, 2008 I didn't try to solve any coding problem because I don't see any. Substituting the "variables" of the situation, here's a paraphrase of your problem: I do not understand why "nick_change" is never '-' even though I have '+' in the database column "nick_change."It's not '-' because you told it to be '+'. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.