Joshua Posted October 5, 2009 Share Posted October 5, 2009 So I have this code defined in my register to send certain users to certain cities upon characther creation based on their race. My problem is everytime a New User creates it sends ALL My users to his city. This is urgent as I have my cities race specified only the correct race can use Explore.php PRz help :P $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"); } else if ('race==2') { $db->query("INSERT INTO userstats VALUES($i, 10, 50, 10, 10, 10, 10)"); $db->query("UPDATE users SET location=1"); } else if ('race==3') { $db->query("INSERT INTO userstats VALUES($i, 50, 10, 10, 10, 10, 10)"); $db->query("UPDATE users SET location=2"); } Quote Link to comment Share on other sites More sharing options...
Taxed Posted October 5, 2009 Share Posted October 5, 2009 $db->query("UPDATE users SET location=3"); Your updating the users database and setting all locations to 3. Try something like this using a varialbe in the where clause. $db->query("UPDATE users SET location=3 WHERE username=' ".mysql_real_escape_string($username). " ' "); You definately need to define a "WHERE" clause to isolate the specific user. so using their username or unique id would do the trick. Hope that helps. Quote Link to comment Share on other sites More sharing options...
Joshua Posted October 5, 2009 Author Share Posted October 5, 2009 Lifesaver, I been up to late and overlooked obvious. Kudos and +10 ^_^ That worked exactly like it should >< Now if i can just get my gym error working i'll be at 95% tnx again. Quote Link to comment 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.