Re: MySQL sort stopped working
| From: | Tony Grimes | Date: | Wed, 14 Mar 2007 04:46:19 +0000 |
| Subject: | Re: MySQL sort stopped working | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-43279@lists.php.net to get a copy of this message | ||
The sql is simple like:
SELECT artist_id
FROM artists
WHERE display_online = '1'
ORDER BY artist_id ACS
The statement works fine in phpMyAdmin and from the command line, but not
from my script, which uses PEAR::DB. It's as if PEAR just omitted the ORDER
BY statement.
Tony
On 3/13/07 5:24 PM, "Chris" <dmagick@gmail.com> wrote:
> Tony Grimes wrote:
>> I have this page that lists artists alphabetically:
>>
>> http://www.wallacegalleries.com/artists.php
>>
>> At least it did until today. Nobody made any changes to the files, but the
>> database stopped sorting by artist_id. The list shown is just the default
>> order that mysql spits out if the SORT BY clause is omitted (as if I clicked
>> 'browse' in phpMyAdmin).
>
> Right. All databases do exactly the same thing. There are no guarantees
> about sorting unless you tell it exactly how to sort.
>
>> The SQL works in phpMyAdmin, and the site uses PEAR::DB. We patched the
>> server last week, but the problem showed up this morning.
>
> What sql? With an order by?