3

I have table called notifications and i have id auto_increment primary key.

Complete Table Structure.

CREATE TABLE IF NOT EXISTS `notifications` (
  `id` int(11) NOT NULL auto_increment,
  `user_id` int(11) NOT NULL,
  `sender_id` int(11) NOT NULL,
  `sender_picture` varchar(300) NOT NULL,
  `title` varchar(300) NOT NULL,
  `message_link` varchar(500) NOT NULL,
  `created` datetime NOT NULL,
  `modified` datetime NOT NULL,
  `status` tinyint(4) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Now problem is that auto_increment should insert record as below.

1 record
2 record
3 record

But its really strange why my phpmyadmin show me record as below.

1 record
3 record
2 record

Is there any options do i need to set in phpmyadmin.

Thank You.

Dipesh Parmar
  • 27,090
  • 8
  • 61
  • 90

2 Answers2

2

Actually it is not a problem. Leave the records as is because those records are inserted randomly on the table.

Just do the ordering you desired during the projection (SELECT statement). eg,

SELECT * 
FROM   TABLENAME 
ORDER  BY colName ASC // or DESC for descending

The clients will not look on the database but on the application you created :D

John Woo
  • 258,903
  • 69
  • 498
  • 492
0

Sometimes the phpmyadmin sorts the records by another field for display.

Sharon Haim Pour
  • 6,595
  • 12
  • 42
  • 64