Re: Numbers in the wrong order
| From: | David Robley | Date: | Mon, 28 Apr 2003 11:43:53 +0000 |
| Subject: | Re: Numbers in the wrong order | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145514@lists.php.net to get a copy of this message | ||
In article <012401c30d78$fe4558a0$0200a8c0@V>, vprince@btinternet.com
says...
> Just a little query to satisfy my curiousity really!
>
> I have a php guestbook which logs all the entries in a mySQL database, now when I go into
> phpMyAdmin and browse the table the entry numbers will go something like:
>
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> 11
> 12
> 13
> 14
> 15
> 55
> 16
> 17
> 18
> 54
> 19
> 20
> 21
> 22
> 23
> 24
> 56
> 57
> 58
> 25
> ...etc
>
> It doesn't effect the order the entries show up or anything, they're all in
> order....just wondered
> why it was doing it!
>
> There's no pattern...it's a pain because I sometimes need to change the entry numbers
> and it makes
> it harder when they're in the wrong order!
That's the way [decent] databases work - they don't store data in any
particular order, but will order it for you when you retrieve according to
your needs. As far as phpMyAdmin, just use an appropriate query to display
the records in the order you want - phpMyAdmin default is to display in
the order they are found. In this case it looks like you just need to
change the query from something like
'SELECT * FROM yourtable WHERE 1'
to
'SELECT * FROM yourtable WHERE 1 ORDER BY entrynumber'
to get them in order of entrynumber - assuming entrynumber is an integer
type.
--
Quod subigo farinam
$email =~ s/oz$/au/o;