Frankie T Posted October 27, 2010 Share Posted October 27, 2010 Hey there, Pretty frustrated with this. It seems so simple, but I've been staring at it and toying with it for ages, so I figured I'd post here. I have a variable called "$isTaken" that seems to be losing its value in an essential step in my function. Take a look. function subdomainTaken($inputtedSubdomain) { //Initialize $isTaken to 'true' $isTaken = true; echo "isTaken STARTS AS: <i>" . $isTaken . "</i><br />"; //FOR TESTING PURPOSES ONLY. VARIABLE HAS VALUE HERE //Check subdomain in database $subdomainDBQuery = mysql_query("SELECT * FROM `companies` WHERE company_subdomain = '$inputtedSubdomain'"); $foundResult = mysql_num_rows($subdomainDBQuery); if ($foundResult > 0) { $isTaken = true; } else { $isTaken = false; } return $isTaken; } By the time I get to the if statement, $isTaken has no value. I've echoed it to be sure. Any ideas? Thanks, Frank Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 27, 2010 Share Posted October 27, 2010 Try var_dump()ing it instead of echoing it. Quote Link to comment Share on other sites More sharing options...
Frankie T Posted October 27, 2010 Author Share Posted October 27, 2010 Ah! Thank you so much! I didn't know about that function. What you told me allowed me to rule out what I thought it was. Turns out, there was just an error in my logic. Thanks again! Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 27, 2010 Share Posted October 27, 2010 I thought that would help you figure out what was going on there . . . Quote Link to comment 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.