Jump to content
MakeWebGames

Ok, So no matter how i change this up, something doesnt work right.


Recommended Posts

Posted

I'm trying to get this 100% but it's always 99%

What I want it to do

 

I want it to set the Users Race in the Database upon registration

and depending on that race send them to a certain City.

 

I can get it to Do one or the other but not both

 

If i change some things up it inserts their ID into userstats but sends them to wrong city

If I change other things up, it sends them to right city but won't Insert them into Userstats

ANY help would be appreciated

 

$db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup, race)
VALUES( '{$username}', '{$username}',md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP', '{$_POST['race']}'
)"); 


$i=$db->insert_id();

if('race'==1)
{
$db->query("INSERT INTO userstats VALUES('$i', 10, 10, 50, 10, 10, 10)");
$db->query("UPDATE users SET location=3 WHERE username='$username'"); 
}

elseif('race'==2)
{
$db->query("INSERT INTO userstats VALUES('$i', 10, 50, 10, 10, 10, 10)");
$db->query("UPDATE users SET location=1 WHERE username='$username'"); 
}


elseif('race'==3)
{
$db->query("INSERT INTO userstats VALUES('$i', 50, 10, 10, 10, 10, 10)");
$db->query("UPDATE users SET location=2 WHERE username='$username'"); 
}

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.   Paste as plain text instead

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