[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Problem comparing two mysql tables...

Asked by paStiSSet in PHP and Databases

Tags: mysql, comparing, tables, two, 2

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("SELECT * FROM levels");
$susers=mysql_query("SELECT * FROM users");

$totalusers=mysql_num_rows($susers);

for($x=1;$x<=$totalusers;$x++) {
      while($user=mysql_fetch_array($susers)) {
            $quid=mysql_query("SELECT * FROM users WHERE id=".$user['id']);
            $uid=mysql_fetch_array($quid);
            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[puntos]) {
                        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)
 
Related Solutions
Keywords: Problem comparing two mysql tables...
 
Loading Advertisement...
 
[+][-]05/15/05 04:59 AM, ID: 14005508Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: PHP and Databases
Tags: mysql, comparing, tables, two, 2
Sign Up Now!
Solution Provided By: dKasipovic
Participating Experts: 2
Solution Grade: A
 
[+][-]05/16/05 05:03 AM, ID: 14009418Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/18/05 10:50 AM, ID: 14029544Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/18/05 12:03 PM, ID: 14030263Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81