SELECT * FROM forum_threads WHERE SectionID = $section ORDER BY date DESC $start,20
That query returns an error.
It worked like this:
SELECT * FROM forum_threads WHERE SectionID = $section
What its mean't to do:
1. Get threads.
2. Only get the ones for this section
3. Order them bye the date.
4. Start from $start and only get 20 results.
Note: $start = page number multiplied by 20.
I have this working but with out the WHERE statement.
Thanks in advanced G2G
MySQL Query WHERE, ORDER BY and start from + amount
Started by bbqroast, Oct 28 2010 08:38 PM
2 replies to this topic
#1
Posted 28 October 2010 - 08:38 PM
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).
|
|
|
#2
Posted 28 October 2010 - 08:46 PM
"SELECT * FROM `forum_threads` WHERE SectionID = $section ORDER BY `date` DESC LIMIT $start, 20"
Edited by John, 28 October 2010 - 10:00 PM.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 29 October 2010 - 01:28 PM
Thanks NullW0rm
Seems i missed the LIMIT part, I still got an error but fixed by removing the ' parts- mayby the wrong key (oh i see its this one ').
Hey what happened to your worm???
Seems i missed the LIMIT part, I still got an error but fixed by removing the ' parts- mayby the wrong key (oh i see its this one ').
Hey what happened to your worm???
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).


Sign In
Create Account


Back to top









