The Little Guy Posted October 3, 2008 Share Posted October 3, 2008 I found this really helpful: When you get stuck on if/elseif/else conditionals, then a good thing to do would be to sit at a bank page (html textarea, notepad, wordpad, or any text editor of your choice). Type up what you want your if/else statement to do in words, NOT IN PHP place all your conditions in there, and type it out as a sentence, NOT a list. Make sure you use grouping properly with: "(", ")". for example: $d = FALSE; $s = 'cat'; if(isset($_COOKIE['myAnimal'])){ $d = TRUE; $s = $_COOKIE['myAnimal']; } ((!$d || $s=='cat') && !isset($_GET['q'])) here is how I would ask the question: How do I get this to evaluate to TRUE if $d is FALSE, or $s is equal to cat, and $_GET['q'] is not set? I was doing this exact same code (with different vars, and values), and as I was going to ask a question on the forum, as I typed it out, it just popped into my head, and it worked! Quote Link to comment https://forums.phpfreaks.com/topic/126954-this-helped-me/ Share on other sites More sharing options...
corbin Posted October 3, 2008 Share Posted October 3, 2008 Uh, how would you code without thinking? No offense, but this post seems kind of common sense. Just got to think about what you're trying to accomplish. Quote Link to comment https://forums.phpfreaks.com/topic/126954-this-helped-me/#findComment-656714 Share on other sites More sharing options...
The Little Guy Posted October 4, 2008 Author Share Posted October 4, 2008 Just saying I sat there for a while, until I wrote it down Quote Link to comment https://forums.phpfreaks.com/topic/126954-this-helped-me/#findComment-656809 Share on other sites More sharing options...
JasonLewis Posted October 4, 2008 Share Posted October 4, 2008 Sometimes it can become confusing, and yes you just need to walk away from the computer at that stage. Do something else then come back and more often then not the solution will come straight to mind. Quote Link to comment https://forums.phpfreaks.com/topic/126954-this-helped-me/#findComment-656820 Share on other sites More sharing options...
waynew Posted October 4, 2008 Share Posted October 4, 2008 Sometimes you mull over a problem so long that you start to pin yourself to one solution. Take a break, have a coffee, take a smoking break, whatever you're into, and think it all over again in your head. Quote Link to comment https://forums.phpfreaks.com/topic/126954-this-helped-me/#findComment-657083 Share on other sites More sharing options...
dropfaith Posted October 4, 2008 Share Posted October 4, 2008 yea i wake up with the fix to alot of my problems from the day before. take a 20 min nap and the answers just appear in my head its weird. it seems to be the only thing that helps me fix issues is a nap or leaving my house/ office Quote Link to comment https://forums.phpfreaks.com/topic/126954-this-helped-me/#findComment-657091 Share on other sites More sharing options...
waynew Posted October 4, 2008 Share Posted October 4, 2008 I remember spending hours trying work out a problem. I was up until 4am. Couldn't solve it, went to sleep and woke up with the solution in my head. Quote Link to comment https://forums.phpfreaks.com/topic/126954-this-helped-me/#findComment-657094 Share on other sites More sharing options...
The Little Guy Posted October 4, 2008 Author Share Posted October 4, 2008 Once I had a dream of how something was done, and when I woke up I tried it and it actually worked! Quote Link to comment https://forums.phpfreaks.com/topic/126954-this-helped-me/#findComment-657105 Share on other sites More sharing options...
waynew Posted October 4, 2008 Share Posted October 4, 2008 You were probably doing Meth. Quote Link to comment https://forums.phpfreaks.com/topic/126954-this-helped-me/#findComment-657116 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.