theflea912 Posted August 2, 2009 Share Posted August 2, 2009 I have a table that contains workout data. The results will be displayed in a table, ordered by date_rowed column, but only take 15 entries. (I have also tried ordering by the id column, which should indicate order as well). Problem is, every time I use this query: $workoutsql = "SELECT * FROM workouts WHERE rowerid='$profile' ORDER BY 'date_rowed' DESC LIMIT 15"; It displays 15 entries; just in the ASC order. I have tried everything I know. Removed DESC, tried ASC, and removed the LIMIT flag; this was the odd one, as when I did this, it ordered it correctly, but displayed ALL the entries. I have also used the id column as well but got the same thing. I have never encountered this behavior before. date_rowed = xxxx-xx-xx num = auto incrementing integer <?php while($row6 = mysql_fetch_array($workoutdata)){ $split = split_calc("$row6[time]","$row6[distance]"); $adjusted_time = format_time("$row6[time]", "$display_format[time_format]"); echo "<tr><td class=\"tablecells\">$row6[date_rowed]</td><td class=\"tablecells\">$row6[distance]m</td><td class=\"tablecells\">$adjusted_time</td><td class=\"tablecells\">$split</td><td class=\"tablecells\">$row6[comments]</td></tr>"; } ?> Obviously, I am missing something here; there is no rule regarding ordering and limiting as far as know. Any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
gevans Posted August 2, 2009 Share Posted August 2, 2009 change $workoutsql = "SELECT * FROM workouts WHERE rowerid='$profile' ORDER BY 'date_rowed' DESC LIMIT 15"; to $workoutsql = "SELECT * FROM workouts WHERE rowerid='$profile' ORDER BY `date_rowed` DESC LIMIT 15"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.