TFG Posted April 17, 2008 Share Posted April 17, 2008 i have this table called details on my database and the details table has a column called category in the category column there are rows having value 1 to 100 so if i do this $query = "SELECT * FROM details ORDER BY category DESC LIMIT 5". $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo $row['category']; echo "<br />"; } it outputs like this 100 100 100 99 99 98 98 so what i am trying to do is limiting 5 values only at once like 100 99 98 97 96 95 pls tell me how i can do this. Link to comment https://forums.phpfreaks.com/topic/101473-simple-mysql-values-limiting-help/ Share on other sites More sharing options...
benphp Posted April 17, 2008 Share Posted April 17, 2008 $query = "SELECT DISTINCT * FROM details ORDER BY category DESC LIMIT 5". Is that what you had in mind? Link to comment https://forums.phpfreaks.com/topic/101473-simple-mysql-values-limiting-help/#findComment-519075 Share on other sites More sharing options...
TFG Posted April 17, 2008 Author Share Posted April 17, 2008 $query = "SELECT * FROM details ORDER BY category DESC LIMIT 5". Is that what you had in mind? oh thanx alot, it works Link to comment https://forums.phpfreaks.com/topic/101473-simple-mysql-values-limiting-help/#findComment-519081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.