Jump to content

[SOLVED] ORDERing and LIMITing a query


theflea912

Recommended Posts

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.