shedokan Posted June 16, 2007 Share Posted June 16, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/55832-help-me-with-displaying-highscores-in-fash-i-got-all-parts-exept-one/ Share on other sites More sharing options...
chigley Posted June 16, 2007 Share Posted June 16, 2007 I really don't have a clue what you're trying to do here. SELECT name, score FROM highscoretable ORDER BY score ASC LIMIT 10 To select the top 10... Quote Link to comment https://forums.phpfreaks.com/topic/55832-help-me-with-displaying-highscores-in-fash-i-got-all-parts-exept-one/#findComment-275808 Share on other sites More sharing options...
redarrow Posted June 16, 2007 Share Posted June 16, 2007 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"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/55832-help-me-with-displaying-highscores-in-fash-i-got-all-parts-exept-one/#findComment-275809 Share on other sites More sharing options...
shedokan Posted June 16, 2007 Author Share Posted June 16, 2007 the point of the number is that I could display them in flash fields. the fields are called name1,name2,name3 and score fields called score1,score2,score3. Quote Link to comment https://forums.phpfreaks.com/topic/55832-help-me-with-displaying-highscores-in-fash-i-got-all-parts-exept-one/#findComment-275816 Share on other sites More sharing options...
chigley Posted June 16, 2007 Share Posted June 16, 2007 Tell us what you need the output to be from your tables and we can probably help, but at the moment I don't have a clue what you want doing Quote Link to comment https://forums.phpfreaks.com/topic/55832-help-me-with-displaying-highscores-in-fash-i-got-all-parts-exept-one/#findComment-275819 Share on other sites More sharing options...
shedokan Posted June 16, 2007 Author Share Posted June 16, 2007 I want the output from the tables to be like this: &name1=The_1st_players_name&score1=The_1st_players_score&name2=The_2nd_players_name&score2=The_2nd_players_score&name3=The_3rd_players_name&score3=The_3rd_players_score Quote Link to comment https://forums.phpfreaks.com/topic/55832-help-me-with-displaying-highscores-in-fash-i-got-all-parts-exept-one/#findComment-275821 Share on other sites More sharing options...
chigley Posted June 16, 2007 Share Posted June 16, 2007 <?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. Quote Link to comment https://forums.phpfreaks.com/topic/55832-help-me-with-displaying-highscores-in-fash-i-got-all-parts-exept-one/#findComment-275822 Share on other sites More sharing options...
shedokan Posted June 16, 2007 Author Share Posted June 16, 2007 when I get back I will try Quote Link to comment https://forums.phpfreaks.com/topic/55832-help-me-with-displaying-highscores-in-fash-i-got-all-parts-exept-one/#findComment-275828 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.