Welcome to WebmasterWorld Guest from 54.227.14.23

Forum Moderators: phranque

Message Too Old, No Replies

MYSQL to php export

sorted by hight

     
1:50 pm on Jul 8, 2010 (gmt 0)

New User

5+ Year Member

joined:July 8, 2010
posts:2
votes: 0


Hi,

I'm coding a ranking for my homepage and now I got a problem with the max:
$result = mysql_query("SELECT * FROM ranking ORDER BY points DESC")or die(mysql_error());


It is quite working, but in the end the result is, that there is no echo of the maximum itself.

example:
NAME  POINTS
person1 125
person2 121
person3 123
person4 122
person5 124


the output would look like:

person5 124
person3 123
person4 122
person2 121


how to get an output of the maximum itself?

thanks in advance
Hendrik
2:14 pm on July 8, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 9, 2010
posts:118
votes: 0


Check your iternation. You are skipping first row in while loop.
Try
while ($row = @mysql_fetch_array($result)){
echo $row[put your field here];
}
5:04 pm on July 8, 2010 (gmt 0)

New User

5+ Year Member

joined:July 8, 2010
posts:2
votes: 0


oh sweet, thx!

Hendrik
7:19 pm on July 8, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10562
votes: 14


welcome to WebmasterWorld [webmasterworld.com], Hendrik!

it is also worth noting that the array index starts at 0, not 1, and that may help explain what you are seeing.