Jump to content

Reordering columns in phpmyadmin and keeping them in that order?


the_toolman

Recommended Posts

Hi there,

 

Is it possible to reorder columns in phpmyadmin and have them remain in that place next time I visit? At the moment, I can drag and re-order them, but when I log back into phpmyadmin, they are reset.

Does anyone know if this is possible? Maybe there is a query I can run?

 

Thanks!

Link to comment
Share on other sites

original table

image.png.36e50c7d44c7fae9d6bcb058982d65be.png

Query...

ALTER TABLE `test`.`user_demo` 
CHANGE COLUMN `username` `username` VARCHAR(20) NULL DEFAULT NULL 
AFTER `userid`;

new table

image.png.75055fd340e5082ea7fefdaf409ecab6.png

[EDIT....]

There are a couple of alternatives.

1 ) Use a query to specify the required column sequence

SELECT fname
     , lname
     , username
     , userid
FROM test.user_demo;

2 ) Create a "view" on the table with the required column sequence.

Edited by Barand
Link to comment
Share on other sites

Hi,

 

Thanks for the reply.

 

So If I were to use the second method, I would use the following:

 

SELECT firstname , lastname , email  FROM tests.wp_d8zma;

 

(my table is called tests and the database called wp_d8zma

 

Will this keep the order each time I log into phpmyadmin?

 

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.