Jump to content

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.

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.