Jump to content

help me with displaying highscores in fash I got all part's exept one.


shedokan

Recommended Posts

Let's say I have this tables:

highscoretable:

name | score

____________

me    | 123

she    | 321

him    | 456

 

 

numbers:

num |

_____

1    |

2    |

3    |

4    |

5    |

6    |

7    |

8    |

9    |

10    |

When I try this code:

 

<?

//here goes the login to database and choose one

$get_num = mysql_query("SELECT num FROM num ORDER BY num LIMIT 10");

$post = mysql_query("SELECT name,score FROM highscoretable ORDER BY score DESC LIMIT 10");

while ($highscoretable = mysql_fetch_array($post)) {

while ($numbers = mysql_fetch_array($get_num)) {

$num = $numbers['num'];

$name = $highscoretable['name'];

$score = $highscoretable['score'];

echo "&name".$num."=".$name."&score".$num."=".$score;

}

}

?>

 

 

it shows me this:

 

&name1=me&score1=123&name1=she&score1=321&name1=him&score1=456

 

it's suppose to show name1,name2,name3 etc.

 

and it shows only name1 why?

Soryy but i dont see the point for the & and $num information as there doing nothink are they?

 

am i going mad lol?

 

limit 10 for what there only 3 there

 

add anther field in the colum and each time there another name added add it to the new field.

 

<?php

$post = mysql_query("SELECT name,score FROM highscoretable ORDER BY score DESC");

while ($x = mysql_fetch_assoc($post)) {

$name = $x['name'];

$score = $x['score'];

   echo "name: $name score: $score";
}
   
?>

<?php

$query = mysql_query("SELECT name, score FROM highscoretable ORDER BY score ASC");
$count = 1;

while(list($name, $score) = mysql_fetch_row($query)) {
$output .= "&name{$count}={$name}&score{$count}={$score}";
$count++;
}

echo substr($output, 1);

?>

 

Try that.

 

 

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.