Joshua Posted July 14, 2009 Posted July 14, 2009 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"); } Quote
Joshua Posted July 14, 2009 Author Posted July 14, 2009 Re: Help fixing a small bug nm i corrected, simple as extending the "race" to "race==1" Quote
AlabamaHit Posted July 14, 2009 Posted July 14, 2009 Re: Help fixing a small bug looks like register, you need to do it like this if($_POST['race'] == 1) { whatever supposed to do. } else if($_POSt['race'] == 2) so on and on. Quote
CrazyT Posted July 14, 2009 Posted July 14, 2009 Re: Help fixing a small bug Yeah. You could use switch() instead or a array() Quote
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.