Jump to content
MakeWebGames

Recommended Posts

Posted

Apparently my eyes are deceiving me.

I'm having problems getting this to work properly. If i go to the Original Code from McCodes it works fine.

However I'm trying to add some else/if statements so differant races start off with differant stats.

For w/e reason when I add these codes in it's not inserting a User ID or anything into userstats...can't for the life of me figure out why

 

$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)");
$db->query("UPDATE users SET location=1");   
}
elseif ("race"=2)
{
$db->query("INSERT INTO userstats VALUES($i, 10, 50, 10, 10, 10)");
$db->query("UPDATE users SET location=2");  
}
elseif ("race"==3)
{
$db->query("INSERT INTO userstats VALUES($i, 50, 10, 10, 10, 10)");
$db->query("UPDATE users SET location=3");  
}

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