korrupt_23 Posted December 3, 2003 Share Posted December 3, 2003 Hmm, well, I\'m really not sure why this coding isn\'t working.. and I\'m usually fair with mySQL.. but.. here goes.. Please tell me if you see anything wrong, even the smallest thing wrong in this code. The problem is it doesn\'t LIMIT to 5, only 1... <? @include("connect2.php"); $sql = "SELECT * FROM clicks ORDER BY \'unique\' DESC LIMIT 5"; $result = mysql_query($sql); $number = mysql_numrows($result); $i = 0; $name = mysql_result($result,$i, "pagename"); $clicks = mysql_result($result,$i, "raw"); $unique = mysql_result($result,$i, "unique"); echo " <TR> <TD WIDTH="40%" ALIGN="CENTER"> $name </TD> <TD WIDTH="25%" ALIGN="CENTER"> $unique </TD> <TD WIDTH="30%" ALIGN="CENTER"> Download </TD> </TR> "; $i++; ?> Anything? Or any ideas? Thanks very much.. Link to comment https://forums.phpfreaks.com/topic/1456-very-puzzling/ Share on other sites More sharing options...
triphis Posted December 3, 2003 Share Posted December 3, 2003 2 things. try mysql_num_rows ... I always do it that way :S And for LIMIT, you can have 2 numbers. it goes LIMIT x,y x = where you start y = how many max So for the first 5, go LIMIT 0,5 for 10-15 LIMIT 10,5 etc... Hope you find the problem Link to comment https://forums.phpfreaks.com/topic/1456-very-puzzling/#findComment-4797 Share on other sites More sharing options...
korrupt_23 Posted December 3, 2003 Author Share Posted December 3, 2003 Thanks man, and I do know about the 0,5, but 5 does work the same.. And yes, I did get it fixed, but I don\'t know how.. I changed too many things at once :oops: Thanks again for trying man! Link to comment https://forums.phpfreaks.com/topic/1456-very-puzzling/#findComment-4798 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.