homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

MYSQL to php export
sorted by hight

Msg#: 4166486 posted 1:50 pm on Jul 8, 2010 (gmt 0)


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.

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



5+ Year Member

Msg#: 4166486 posted 2:14 pm on Jul 8, 2010 (gmt 0)

Check your iternation. You are skipping first row in while loop.
while ($row = @mysql_fetch_array($result)){
echo $row[put your field here];


Msg#: 4166486 posted 5:04 pm on Jul 8, 2010 (gmt 0)

oh sweet, thx!



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

Msg#: 4166486 posted 7:19 pm on Jul 8, 2010 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved