Jump to content

Variable Seems to be Losing its Data


Frankie T

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.