homepage Welcome to WebmasterWorld Guest from 54.161.247.22
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

    
MYSQL to php export
sorted by hight
Hemer




msg:4166488
 1:50 pm on Jul 8, 2010 (gmt 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

 

curioustoddler




msg:4166505
 2:14 pm on Jul 8, 2010 (gmt 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];
}

Hemer




msg:4166649
 5:04 pm on Jul 8, 2010 (gmt 0)

oh sweet, thx!

Hendrik

phranque




msg:4166741
 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