Hi, i must explain this as easy as i can, so lets do an example of all:
table1:
puntos,level
1,6
2,18
....
31337,99
table2:
id,nick,puntos,level
0,paStiSSet,577,1
1,otro,223,1
well, table1 contains the partners to compare the users points with each level required points.. so i did this code to compare and "only echo this time" the level that pertains to the user:
<?
include("conn.php");
$qlevels=mysql_query("SELE
CT * FROM levels");
$susers=mysql_query("SELEC
T * FROM users");
$totalusers=mysql_num_rows
($susers);
for($x=1;$x<=$totalusers;$
x++) {
while($user=mysql_fetch_ar
ray($suser
s)) {
$quid=mysql_query("SELECT * FROM users WHERE id=".$user['id']);
$uid=mysql_fetch_array($qu
id);
echo "$uid[nick] has $uid[puntos] points and level $uid[baselevel]<br>";
echo "Calculando level...<br>";
for($y=0;$y<=99;$y++) {
$level=mysql_fetch_array($
qlevels);
if($uid[puntos]>=$level[pu
ntos]) {
echo "$uid[puntos] is bigger than $level[puntos]<br>";
}else{
echo "$uid[puntos] isnt bigger than $level[puntos] his level must be $y<br>";
break;
}
}
echo "<br>";
}
}
?>
when i execute the php it begins comparing but the results are not what i want... see:
paStiSSet has 346 points and level 99
Calculando level...
346 is bigger than 0
346 is bigger than 6
346 is bigger than 18
346 is bigger than 37
346 is bigger than 63
346 is bigger than 94
346 is bigger than 132
346 is bigger than 177
346 is bigger than 227
346 is bigger than 284
346 isnt bigger than 348 his level must be 10
prueba has 543 points and level 1
Calculando level...
543 is bigger than 417
543 is bigger than 493
543 isnt bigger than 576 his level must be 2
pokotro has 1 points and level 1
Calculando level...
1 isnt bigger than 664 his level must be 0
safasfsafsadfasdf has 0 points and level 1
Calculando level...
0 isnt bigger than 759 his level must be 0
Chaindog has 14 points and level 1
Calculando level...
14 isnt bigger than 860 his level must be 0
--------------------------
----------
----------
----------
----------
----------
as you can see $level[puntos] is not being reset, and thats what im looking for in this question... how to reset $level[puntos] in fact to compare another user, beginning from 0...
thanks (and sorry for this bad english ;s)