Order by?

Forum
Last Post
Threads / Messages

SilverDragonTears

I am your Nemesis.
Premium Member
Joined
Jun 1, 2011
Messages
1,113
Points
36
Mysidian Dollar
51,802
How do I order this by itemname? I still don't quite understand the new coding :/

Code:
	  $stmt = $GLOBALS['adopts']->select("items", array(), "shop ='{$this->shopname}'");
 
Well just pass ORDER BY to the whereclause, if you have a whereclause. Incase you do not have a whereclause(and thus selecting all rows), you can do the following:

PHP:
$stmt = $GLOBALS['adopts']->select("items", array(), "1 ordered by itemname");

It may look a bit funny, but the magical keyword '1' does the trick for ya.
 
This isn't ordering by cost...
Code:
    $stmt = $adopts->join("adoptables_conditions", "adoptables_conditions.id = adoptables.id")
				   ->select("adoptables", array(), "breed = 'short'", "1 ordered by cost ASC");
 
@Silver Kitsune
Yeah sorry about that. The new release will include a much better database class. Although I won't say that it's comprehensive or anything, but it should suffice for most of the needed queries.

But anyway, the right keyword is ORDER BY not ORDERED BY.
 
Oh my goodness, made a typo in that php code I wrote. Didnt realize that since I did say 'ORDER BY' at the beginning of my post, did I? XD
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,280
Messages
33,132
Members
1,603
Latest member
Monako
BETA

Latest Threads

Top