Jump to content

[SOLVED] Displaying Rank issues


Dracolas

Recommended Posts

Ok I'm setting up my Memberslist page on my site and i'm using a rank system.

 

I've got the array working... I've got the query working...but when i do

 

$crank = $rank[$row['rank']];
$result = mysql_query("SELECT * FROM users");

while($row = mysql_fetch_assoc($result)){
   echo "<br>Name:".$row['username'];
   echo "<br>Rank: "; echo $crank;
} ;

it only displays the first rank in the database but when I do

while($row = mysql_fetch_assoc($result)){
   echo "<br>Name:".$row['username'];
   echo "<br>Rank: " .$row['rank'];
} ;

it displays each members rank as a number...how do I get it to display using the array with the when...

 

Thank you !

Link to comment
https://forums.phpfreaks.com/topic/180167-solved-displaying-rank-issues/
Share on other sites

in this example

$crank = $rank[$row['rank']];
$result = mysql_query("SELECT * FROM users");

while($row = mysql_fetch_assoc($result)){
   echo "<br>Name:".$row['username'];
   echo "<br>Rank: "; echo $crank;
} ;

 

the crank is only set once. Perhaps you meant to do


$result = mysql_query("SELECT * FROM users");

while($row = mysql_fetch_assoc($result)){
   $crank = $rank[$row['rank']];
   echo "<br>Name:".$row['username'];
   echo "<br>Rank: "; echo $crank;
}//why was there a semi colon here?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.