Jump to content
MakeWebGames

Recommended Posts

Posted

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");   
}
Posted
$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.

Posted

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.

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