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
https://forums.phpfreaks.com/topic/216953-variable-seems-to-be-losing-its-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.