Forum Moderators: coopster

Message Too Old, No Replies

Question about $userid

where to start?

         

xkid

12:23 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



Hi!

I'm trying to set up a game for my friends and myself, and now i have comed to this point that i want to change the user IDs..

Now the IDs is like:

1,2,3,4,5,6 and so on..

And what I i want is:

1:1 , 1:2 , 1:3 , 2:1 , 2:2 , 2:3

I know its pretty hard for you to help when you dont have my script but can any give me hint of where to start?

I would greatly appreciate it! :D

Regards

mcibor

1:43 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What I would do is keep the ids as they are, but change the output:

$output = (int)($id/3); //integer from division
$output .= ":";//separator
$output .= $id % 3 + 1;// rest from division by 3

now output should be in format 3:1 = 3*3 + 1 - 1 = 9 = id

Best regards!
Michal Cibor

xkid

4:14 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



Hi, thanks, getting closer! :)

The thing now is that all the players has equal "IDs"...:

1:2
1:2
1:2

Heres the relevant codes (i think :P) :

options.php:

$output = (int)($Userid/3); //integer from division
$output .= ":";//separator
$output .= $Userid % 3 + 1;// rest from division by 3

----

players.php:

<td><font face=\"Arial\" size=\"2\">$output</td>

Can you help me out here..? :P

xkid

5:56 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



I figured it out :)

thanks!

bennymack

6:18 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



Looks like you need some sort of incrementation in the "3+1" portion of code. Probably need something like "3+$i++" or similar. What you're doing now is repeatedly checking it against "mod 3 plus 1" if that makes sense.

xkid

10:38 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



I used $page to set the first number, and just a regular count function as the second number, works fine for my purpose :)