-1
I’m trying to create a code in php to build a ranking, I managed to make the data appear, the problem is that is duplicating the results.
$rank = mysql_query("SELECT * FROM user_quizzes ORDER BY pass_score_point DESC") or die(mysql_error());
$i = 0;
while($row = mysql_fetch_assoc($rank)){
$i++;
$rank2 = mysql_query("SELECT * FROM users WHERE not UserName='admin' ORDER BY UserName DESC") or die(mysql_error());
$i2 = 0;
while($row2 = mysql_fetch_assoc($rank2)){
$i2++;
$result = mysql_query('SELECT SUM(pass_score_point) AS pass_score_point FROM user_quizzes' );
$row3 = mysql_fetch_assoc($result);
$sum = $row3['pass_score_point'];
?>
<div class="topo">
<?php echo $row2['UserName']; ?> com <?php echo $row3['pass_score_point']; ?> pontos de acertos!
</div>
Post the rest of the code where you search the data...
– Mayron Ceccon
Sorry I didn’t see, that I hadn’t gone, ready
– Ricardo Goncalves
put your database query
– user28266
remove your connection data if it will not enter your db
– user28266
I’ve already taken, thank you
– Ricardo Goncalves
Those whiles there are weird are all chained up? use the button
{ }
to format the code.– rray
you better exchange your password in favor only for security issues
– user45474