"Satisfactory answer will be added" phpmyadmin in the table under the Browse page as long as the primary key ordering, you can no longer select the primary key ordering

Source: Internet
Author: User
"Satisfied answer will be added" phpmyadmin in the table under the Browse page as long as the primary key ordering, you can no longer select the primary key ordering
This post was last edited by Shendaowu on 2013-04-06 21:32:01

I'm using the XAMPP v3.1.0 Windows edition.
I found that the last record inserted after inserting a record in PHP is not the last one in phpMyAdmin, then I click the ID in the header of the result, and then the query result is incremented by ID, and the query statement becomes this:
SELECT *
From table
ORDER by table. ' ID ' ASC
LIMIT 0, 30
Changes can only modify the SELECT * from table this part, the following can not be modified.
and click on the primary key to sort the dropdown list after the jobless is not responding, you cannot remove the ORDER BY clause.
The strange thing is that I deleted the table after it was exported, and then there was an ORDER BY clause in the import.

I have three questions, the first is how to get rid of the ORDER BY clause, the second is the last record inserted in PHP in phpMyAdmin, why not the last one, and the third is the order of the results without order is the physical order of the database.

--------------------------------------------------
I just recovered that thing myself, and that thing was saved in the Pma_table_uiprefs table in the phpMyAdmin database, and after the deletion of the tables corresponding to the interface error, the restart service resumed. That table blob file I looked, it seems that some phpMyAdmin interface configuration, do not know whether the deletion will be a problem? After removing the ORDER BY clause, the sequence is messy.
--------------------------------------------------
There's something I didn't say:
The primary key of the table is set to self-increment key. I imported some data before inserting it in PHP, like this:
1 xx
2 SS
3 RR
Then insert it in PHP. After multiple insertions, this is the case:
1 xx
2 SS
3 RR
4 WW

1 xx
2 SS
3 RR
5 EE
4 WW

1 xx
2 SS
3 RR
6 TT
5 EE
4 WW

But I just import the structure of the table and insert it with PHP is normal. However, when inserting the ID is not starting from 0, but rather a larger number, should be the last ID to use the next, such as:
+ GG
+-II
How do you make it start from 0? (Or is it 1?) )

Really do not want to waste points, my problem is more, points or save a bit of it. If there is a satisfactory answer I will add points, if it can be fully resolved I will add 80 points, including the direct deletion of the phpMyAdmin database in the table records will not be a problem.


------Solution--------------------
Run SQL:
ALTER TABLE ' Your table name ' Auto_increment=1

The precondition is that the current table data is empty;
------Solution--------------------
The first one is how to get rid of the ORDER BY clause
One more time.

The second is when the last record inserted in PHP is viewed in phpmyadmin. Why not the last one ?
See if it's the last, depending on the value and sort of the primary key

The third is whether the order of the results of an order by is the physical order in the database
Default sort primary Key ascending
Can be understood as physical order

Execute before inserting data
SET sql_mode= "No_auto_value_on_zero";
Can disable "self-increment", but you need to ensure that the primary key is unique

Command
TRUNCATE Table Name
The table can be emptied and the "self-increment" reset
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.