SamiBH Posted August 9, 2010 Share Posted August 9, 2010 Hello, I have this query "SELECT f.file_id as file_id, f.downloads+ifnull(x.downloaders,0) as downloads , f.comment,f.link,f.poster,f.iamge1,f.iamge2,f.iamge3, f.read + ifnull(x.read,0) as read, dlbytes AS dwned, format(f.finished+ifnull(x.completed,0),0) as finished, filename, url, info, UNIX_TIMESTAMP(data) AS added, c.image, c.name AS cname, category AS catid, uploader FROM {$TABLE_PREFIX}files as f LEFT JOIN xt_files x ON f.bin_file_id=x.file_id LEFT JOIN {$TABLE_PREFIX}categories as c ON c.id = f.category WHERE f.read + ifnull(x.read,0) + f.downloads+ifnull(x.downloaders,0) > 0 ORDER BY data LIMIT 0 , 18"; that won't work --- when I use ORDER BY data DESC LIMIT 0 , 18 it only list the last 24 hours( or 22 hours.not sure) witch is allows under 18 posts if I use ORDER BY data ASC LIMIT 0 , 18 it won't show anything ---- MySQL client version: 4.1.22 Data Field Type: datetime (2010-08-09 05:31:32) How to make it list the last 18 posts not only last 24 hours thank you Quote Link to comment https://forums.phpfreaks.com/topic/210185-order-by-date-doesnt-work/ Share on other sites More sharing options...
SamiBH Posted August 9, 2010 Author Share Posted August 9, 2010 sorry... *Which is Always under 18 posts Quote Link to comment https://forums.phpfreaks.com/topic/210185-order-by-date-doesnt-work/#findComment-1097006 Share on other sites More sharing options...
fenway Posted August 10, 2010 Share Posted August 10, 2010 The number of records has nothing to do with which records are considered -- so I don't understand your question. Quote Link to comment https://forums.phpfreaks.com/topic/210185-order-by-date-doesnt-work/#findComment-1097303 Share on other sites More sharing options...
SamiBH Posted August 10, 2010 Author Share Posted August 10, 2010 thank you for the raply, will try to make my self clear when i try the query with out "LIMIT" it works fine ORDER BY data DESC >>> prints 89 posts my problem is when I use "LIMIT" ORDER BY data DESC LIMIT 0,18 >>> prints 7 posts !! (SHOULD PRINTS 18) ORDER BY data DESC LIMIT 0,19 >>> prints 11 posts (SHOULD PRINTS 19) ORDER BY data DESC LIMIT 0,20 >>> prints 12 posts (SHOULD PRINTS 20) and number of posts will decrease over time (now it shows 11 posts after 5 hours it will be something like 7 posts) And if I use "ASC" order ORDER BY data ASC >>> 0 result "no error" (SHOULD PRINTS 89 LIKE "DESC") --- THIS PROBLEM ONLY WITH MySQL client version: 4.1.22 ON MY LOCALHOST with MySQL client version: 5.1.37 THE QUERY WORKS FINE WITH LIMIT Quote Link to comment https://forums.phpfreaks.com/topic/210185-order-by-date-doesnt-work/#findComment-1097345 Share on other sites More sharing options...
fenway Posted August 10, 2010 Share Posted August 10, 2010 That's all but impossible -- executive this query from the command-line, or phpmyadmin, and prove it. Quote Link to comment https://forums.phpfreaks.com/topic/210185-order-by-date-doesnt-work/#findComment-1097551 Share on other sites More sharing options...
SamiBH Posted August 10, 2010 Author Share Posted August 10, 2010 thank you fenway the error was from php code Quote Link to comment https://forums.phpfreaks.com/topic/210185-order-by-date-doesnt-work/#findComment-1097569 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.