Jump to content

Can't seem to find my problem


Leveecius

Recommended Posts

Hey guys, I've been trying to add something new to my game, but can't quite seem to figure out why it's not working.  Here is my code (sorry if it's kinda sloppy):

 

if ($family == '0'){
if ($_POST['Create']){
$familyname=strip_tags($_POST['familyname']);
$size=strip_tags($_POST['size']);

if($cnt>10){
die("No more family spaces available!");
}
$blahhh = mysql_query("SELECT * FROM `family` WHERE name = '$familyname'");
if($familyname = '$blahhh') { die('There is already a family with this name'); }
if (!$familyname){
echo "You need to enter a name for your family.";
}elseif ($familyname){
if ($family != '0'){
echo "You are already in a family.";
}elseif ($family == '0'){

if ($size == 3){
$price = 2500000;
$users = 10;
}elseif ($size == 2){
$price = 10000000;
$users = 25;
}elseif ($size == 3){
$price = 20000000;
$users = 100;
}elseif ($size == 4){
$price = 30000000;
$users = 150;
}

 

Now, the problem I keep running into is that it keeps telling me there is already a family with that name, however, there are no families in my game, NOR are there even any in my database.  Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/189330-cant-seem-to-find-my-problem/
Share on other sites

Try taking the

if($familyname = '$blahhh')

and making it

if($familyname = $blahhh)

 

Highly doubt that will do anything, but sometimes it's buggy with extra quotes. Unless you actually looking for it to be compared to $blahhh as a text then try

if($familyname = '\$blahhh')

 

Otherwise yeah I don't find anything that looks off to me and still that should cause your output to be not what you're are getting even if that was a problem...  but never know sometimes.

Oh Duh....

 

I can't believe I missed this.. try this too.

 

if($familyname == '$blahhh')

or this

if($familyname == $blahhh)

. You are making $familyname equal everytime it looks like instead of comparing it if that is what you wanted to do.

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.