[If you have a satisfactory answer, you will be given extra points.] you only need to select a primary key for sorting on the Browse page of the table in PHPMyAdmin. you cannot select a primary key for sorting.

Source: Internet
Author: User
[If you have a satisfactory answer, you will be given extra points.] you only need to select a primary key sorting option on the Browse page of the table in PHPMyAdmin. you cannot select a primary key-free sorting option again. I use XAMPP v3.1.0 for Windows.
I found that the last inserted record is not the last record in PHPMyAdmin after I inserted the record in PHP. I clicked the id in the result header, and then the query result is sorted progressively by id, the preceding query statement also becomes:
SELECT *
FROM table
Order by table. 'id' ASC
LIMIT 0, 30
Only the SELECT * FROM table section can be modified. the following cannot be modified.
In addition, the error in the drop-down list after clicking the sort primary key does not respond, and the order by clause cannot be removed.
The strange thing is that I deleted the table after exporting it, and the ORDER BY clause still exists after importing it.

I have three questions: The first is how to remove the ORDER BY clause, and the second is why the last record inserted in PHP is not the last record in PHPMyAdmin, the third is whether the ORDER of results without order by is the physical ORDER in the database.

--------------------------------------------------
I restored the item myself. it was saved in the pma_table_uiprefs table in the phpmyadmin Database. after deleting the records corresponding to the table with an error in the interface, I restarted the service and recovered. I have read the BLOB file in that table. it seems to be the configuration of some PHPMyAdmin interfaces. I don't know if there will be any problems if I delete it? After the order by clause is removed, the ORDER is disordered.
--------------------------------------------------
There are some other things I did not say:
I have set the primary key of that table as the auto-incrementing primary key. Before using PHP to insert data, I imported some data, similar to the following:
1 xx
2 ss
3 rr
Then insert it in PHP. After multiple inserts, it is as follows:
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

However, after I only import the table structure, it is normal to use PHP to insert it. However, at the time of insertion, the id does not start from 0, but is a relatively large number. it should be the next of the last id used, as shown in the following code:
40 gg
41 ii
How can we make it start from 0? (Or 1 ?)

I really don't want to waste points. I have a lot of problems. I 'd like to save some points. If there is a satisfactory answer, I will add points. if it can be completely solved, I will add 80 points, including directly deleting the records in the table in the phpmyadmin database.


Reply to discussion (solution)

Run SQL:

Alter table 'Your table name' AUTO_INCREMENT = 1

The premise is that the data in the current table is empty;

The first one is how to remove the order by clause.
Click again

The second is to use PHP to insert the last record in PHPMyAdmin. why is it not the last record?
Whether the last entry is displayed depends on the value of the primary key and the sorting method.

The third is whether the ORDER of results without order by is the physical ORDER in the database.
Sort by default in ascending order of the primary key
It can be understood as a physical order.

Run the command before inserting data.
SET SQL _MODE = "NO_AUTO_VALUE_ON_ZERO ";
This will invalidate auto-increment, but you need to ensure that the primary key is unique.

Command
Truncate table name
You can clear the table and reset it with auto-increment.

The first one is how to remove the order by clause.
Click again

The second is to use PHP to insert the last record in PHPMyAdmin. why is it not the last record?
Whether the last entry is displayed depends on the value of the primary key and the sorting method.

The third is whether the ORDER of results without order by is the physical ORDER in the database.
Sort by default in ascending order of the primary key
It can be understood as a physical order.

Run the command before inserting data.
SET SQL _MODE = "NO _......
Added 30 points.

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.