Re: Natural order of things.
| From: | Robert Cummings | Date: | Wed, 26 Apr 2006 20:57:02 +0000 |
| Subject: | Re: Natural order of things. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234854@lists.php.net to get a copy of this message | ||
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"
>
> But, it sorts stuff like this:
>
> Basel Square 1
> Basel Square 10
> Basel Square 11
> Basel Square 2
> Basel Square 3
> Basel Square 4
> Basel Square 5
> Basel Square 6
> Basel Square 7
> Basel Square 8
> Basel Square 9
>
> What do I have to change to get it (the query) to sort like this:
>
> Basel Square 1
> Basel Square 2
> Basel Square 3
> Basel Square 4
> Basel Square 5
> Basel Square 6
> Basel Square 7
> Basel Square 8
> Basel Square 9
> Basel Square 10
> Basel Square 11
>
> Thanks in advance for any answers/suggestions
You need ot perform a type conversion from string to integer.
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. |
`------------------------------------------------------------'