Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Order by? (http://www.mysidiaadoptables.com/forum/showthread.php?t=3612)

SilverDragonTears 04-20-2012 01:06 AM

Order by?
 
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}'");


Hall of Famer 04-20-2012 05:26 AM

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 Code:

$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.

SilverDragonTears 05-02-2012 01:24 AM

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");


fadillzzz 05-02-2012 06:28 AM

@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.

Hall of Famer 05-02-2012 11:51 PM

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


All times are GMT -5. The time now is 11:49 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.