dbTalk Databases Forums  

Re: mysql table order and php sort() ?

comp.databases.mysql comp.databases.mysql


Discuss Re: mysql table order and php sort() ? in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: mysql table order and php sort() ? - 05-23-2011 , 03:04 AM






On 2011-05-23 09:19, geoff (AT) invalid (DOT) invalid wrote:
Quote:
Hello

Using the code,

echo "Order: $key, Number: $value <br />";

I see $value as 11 to 20 followed by 51 to 60 but when the data goes
into the mysql table I see 59 down to 51 followed by 20 down to 11
followed by 60.

Why not in ascending numeric order in the table?
A table has no order. If you want to order retrieved data you have to
specify it with the order by clause in your select statement.

/Lennart

[...]

Reply With Quote
  #2  
Old   
geoff@invalid.invalid
 
Posts: n/a

Default Re: mysql table order and php sort() ? - 05-23-2011 , 03:21 AM






On Mon, 23 May 2011 10:04:24 +0200, Lennart Jonsson
<erik.lennart.jonsson (AT) gmail (DOT) com> wrote:

Quote:
On 2011-05-23 09:19, geoff (AT) invalid (DOT) invalid wrote:
Hello

Using the code,

echo "Order: $key, Number: $value <br />";

I see $value as 11 to 20 followed by 51 to 60 but when the data goes
into the mysql table I see 59 down to 51 followed by 20 down to 11
followed by 60.

Why not in ascending numeric order in the table?

A table has no order. If you want to order retrieved data you have to
specify it with the order by clause in your select statement.

/Lennart

[...]
Lennart,

Thanks for your reply.

I do currently use 'order by' the date/time and wish to keep that
order - is it possible to keep this order but also order by the
question number field (an integer)?

Cheers

Geoff

Reply With Quote
  #3  
Old   
geoff@invalid.invalid
 
Posts: n/a

Default Re: mysql table order and php sort() ? - 05-23-2011 , 03:28 AM



On Mon, 23 May 2011 10:04:24 +0200, Lennart Jonsson
<erik.lennart.jonsson (AT) gmail (DOT) com> wrote:

Quote:
On 2011-05-23 09:19, geoff (AT) invalid (DOT) invalid wrote:
Hello

Using the code,

echo "Order: $key, Number: $value <br />";

I see $value as 11 to 20 followed by 51 to 60 but when the data goes
into the mysql table I see 59 down to 51 followed by 20 down to 11
followed by 60.

Why not in ascending numeric order in the table?

A table has no order. If you want to order retrieved data you have to
specify it with the order by clause in your select statement.

/Lennart

[...]
Lennart

got it! order by field1, field2 ...

Cheers

Geoff

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.