Leveecius Posted January 21, 2010 Share Posted January 21, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/189330-cant-seem-to-find-my-problem/ Share on other sites More sharing options...
gwolgamott Posted January 21, 2010 Share Posted January 21, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189330-cant-seem-to-find-my-problem/#findComment-999474 Share on other sites More sharing options...
gwolgamott Posted January 21, 2010 Share Posted January 21, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189330-cant-seem-to-find-my-problem/#findComment-999478 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.