Hi
I have a table which has an auto incrementing primary key column which for some reason is out of order.
I can sort it in phpmyadmin but it keeps falling out of order and I'm not sure why.
Any thoughts anyone ?
| SitePoint Sponsor |
Hi
I have a table which has an auto incrementing primary key column which for some reason is out of order.
I can sort it in phpmyadmin but it keeps falling out of order and I'm not sure why.
Any thoughts anyone ?


Are they being assigned numbers out of order? Or do they only look out of order to you when using phpMyAdmin?
Try this comparison. You normally read left to right, top to bottom. Do you fill your kitchen cabinets and drawers that way? Or do you put things where they'll fit and where you can get the most frequently used items more easily?
MySQL does something similar. It only looks out of order to you, to MySQL it makes perfect sense.

To tell phpmyadmin to order by any particular field you need to click once on the field heading for ascending order and twice for decending order.
Databases do not keep the data in order by any particular field - they keep the data arranged to minimise the space it uses and maximise the ability to retrieve whatever is required quickly. Any order is imposed by specifying the order you want the desired information tretrieved in.
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
Bookmarks