phpmyadmin - Mysql table lists rows not in order -
today inserted row in mysql table strange happened because last added row higher primary id before other rows lower id , after other rows lower id this:
+---------+ | user_id | +---------+ | 1 | | 50 | | 69 | <=== wrong place | 63 | +---------+
this how listed in phpmyadmin, , in php script. understand if dont define in php script in order list rows in phpmyadmin dont know why happening. btw first time see this.
this result of query: show create table mytable
create table `users` ( `user_id` bigint(20) not null auto_increment comment 'auto incrementing user_id of each user, unique index', `web_id` varchar(166) collate utf8_unicode_ci not null, `user_name` varchar(64) collate utf8_unicode_ci not null comment 'user''s name', `user_password_hash` varchar(255) collate utf8_unicode_ci not null comment 'user''s password in salted , hashed format', `user_email` varchar(64) collate utf8_unicode_ci not null comment 'user''s email', `domain` varchar(50) collate utf8_unicode_ci not null, `address` varchar(166) collate utf8_unicode_ci not null, `billing_firstname` varchar(166) collate utf8_unicode_ci not null, `billing_lastname` varchar(166) collate utf8_unicode_ci not null, `billing_phone` varchar(90) collate utf8_unicode_ci not null, `billing_country` varchar(50) collate utf8_unicode_ci not null, `git_auto_update` enum('y','n') collate utf8_unicode_ci not null default 'y', `server_id` int(16) not null, `trial` enum('0','1') collate utf8_unicode_ci not null, `purchase_date` timestamp not null default current_timestamp on update current_timestamp, primary key (`user_id`), unique key `user_name` (`user_name`) ) engine=myisam auto_increment=39 default charset=utf8 collate=utf8_unicode_ci comment='user data'
this guess here goes...
your table layout
create table `users` ( `user_id` bigint(20) not null auto_increment comment 'auto incrementing user_id of each user, unique index', `web_id` varchar(166) collate utf8_unicode_ci not null, `user_name` varchar(64) collate utf8_unicode_ci not null comment 'user''s name', `user_password_hash` varchar(255) collate utf8_unicode_ci not null comment 'user''s password in salted , hashed format', `user_email` varchar(64) collate utf8_unicode_ci not null comment 'user''s email', `domain` varchar(50) collate utf8_unicode_ci not null, `address` varchar(166) collate utf8_unicode_ci not null, `billing_firstname` varchar(166) collate utf8_unicode_ci not null, `billing_lastname` varchar(166) collate utf8_unicode_ci not null, `billing_phone` varchar(90) collate utf8_unicode_ci not null, `billing_country` varchar(50) collate utf8_unicode_ci not null, `git_auto_update` enum('y','n') collate utf8_unicode_ci not null default 'y', `server_id` int(16) not null, `trial` enum('0','1') collate utf8_unicode_ci not null, `purchase_date` timestamp not null default current_timestamp on update current_timestamp, primary key (`user_id`), unique key `user_name` (`user_name`) ) engine=myisam auto_increment=39 default charset=utf8 collate=utf8_unicode_ci comment='user data'
my gut feeling says the user_id
values coming out in user_name
order. happens when there both primary key , unique key. can verify running
select user_id,user_name users; select user_id,user_name users order user_id; select user_id,user_name users order user_name;
and comparing output
Comments
Post a Comment