Re: Natural order of things.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2006-04-26 at 21:15, tedd wrote:
> >On Wed, 2006-04-26 at 16:57, Robert Cummings wrote:
> >>  On Wed, 2006-04-26 at 16:51, tedd wrote:
> >>  > Hi gang:
> >>  >
> >>  > I posted the following question to the MySQL list, but the only
> >>  > answer I received thus far was a php solution (it didn't work for
> >>  > what I wanted).
> >>  >
> >>  > As such, maybe if I post a MySQL question to the PHP group, then I'll
> >>  > receive a MySQL answer -- so here goes:
> >>  >
> >>  > I'm using the following query, and it works.
> >>  >
> >>  > SELECT id, title, url_image_small
> >>  > FROM $dbtable
> >>  > WHERE type="type_title"
> >>  > ORDER BY title
> >>  > LIMIT $offset, $rowsPerPage"
> >  > >
> >-snip-
> >  > You need ot perform a type conversion from string to integer.
> >
> >Sorry, just realized... "Basel Square" is part of the entry in the table
> >:/ Do you have entries that aren't prefixed with Basel Square?
> >
> >Cheers,
> >Rob.
> 
> Rob:
> 
> Yes, there are other titles, such as:
> 
> Celtic Deco 1
> Lucerne 1
> Dutch Hearth 1
> 
> and so on...
> 
> You can see the sort in action at:
> 
> http://ancientstones.com/catalog.php

Ok, first off I would strongly suggest punting the version ID to it's
own table column and stripping from the current column. Then you can
build the string and perform proper ordering. If that's not an option,
then you CAN do what you want (provided the first digit always signifies
the version number) using the following functions:

    LOCATE()
    SUBSTRING()
    IF()

It's not pretty though :) I'd write it up, but don't have time atm.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux