TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-20-2008, 10:21 PM   #1 (permalink)
Nor
The Addict
 
Join Date: Nov 2007
Posts: 282
Thanks: 61
Nor is on a distinguished road
Default Order By

Right I got this sql table called `allepisodes` that has 2 rows one called seasons and one called episodes.

The more data i add all have different seasons and different episodes, but when i output the episodes I want them to be ordered by the season in asc order and i also want to order them by the episode # so E.G::

Code:
id | episode | season | episodename
1 | 1 | 1 | example1
2 | 2 | 1 | example2
3 | 4 | 1 | example4
4 | 3 | 1 | example3
1 | 1 | 2 | example1
2 | 2 | 2 | example2
3 | 4 | 2 | example4
4 | 3 | 2 | example3
See how they are unordered I want them ordered like so:

Code:
1 | 1 | 1 | example1
2 | 2 | 1 | example2
4 | 3 | 1 | example3
3 | 4 | 1 | example4
1 | 1 | 2 | example1
2 | 2 | 2 | example2
4 | 3 | 2 | example3
3 | 4 | 2 | example4
Thats how I want them outputted, ordered by the season first then order by the episode id in ASC
__________________
PHP/XHTML Freelancer:
Cleanscript.com v3 - Programming starting at just $5 act now!
Nor is offline  
Reply With Quote
Old 02-20-2008, 10:35 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

"ORDER BY season ASC, episode ASC" should work fine.
Salathe is offline  
Reply With Quote
Old 02-20-2008, 10:39 PM   #3 (permalink)
Nor
The Addict
 
Join Date: Nov 2007
Posts: 282
Thanks: 61
Nor is on a distinguished road
Default

Thanks, I'll give that a try.
__________________
PHP/XHTML Freelancer:
Cleanscript.com v3 - Programming starting at just $5 act now!
Nor is offline  
Reply With Quote
Old 02-20-2008, 10:45 PM   #4 (permalink)
The Wanderer
 
Join Date: Feb 2008
Posts: 9
Thanks: 1
NathanH is on a distinguished road
Default

I'm a bit late, but that's what I would have done or tried (doesn't make me feel like such a newbie now Salathe has said it!). Let us know what happens :)
NathanH is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:58 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design