the_toolman Posted February 16, 2021 Share Posted February 16, 2021 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! Quote Link to comment https://forums.phpfreaks.com/topic/312160-reordering-columns-in-phpmyadmin-and-keeping-them-in-that-order/ Share on other sites More sharing options...
Barand Posted February 16, 2021 Share Posted February 16, 2021 (edited) original table Query... ALTER TABLE `test`.`user_demo` CHANGE COLUMN `username` `username` VARCHAR(20) NULL DEFAULT NULL AFTER `userid`; new table [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 February 16, 2021 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/312160-reordering-columns-in-phpmyadmin-and-keeping-them-in-that-order/#findComment-1584511 Share on other sites More sharing options...
the_toolman Posted February 16, 2021 Author Share Posted February 16, 2021 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! Quote Link to comment https://forums.phpfreaks.com/topic/312160-reordering-columns-in-phpmyadmin-and-keeping-them-in-that-order/#findComment-1584524 Share on other sites More sharing options...
Barand Posted February 16, 2021 Share Posted February 16, 2021 1 hour ago, the_toolman said: Will this keep the order each time I log into phpmyadmin? No, but it it gives you a way of viewing the data in order you want. To make it permanent you woud have to ALTER the table or create a view with required order and use that instead of the table. Quote Link to comment https://forums.phpfreaks.com/topic/312160-reordering-columns-in-phpmyadmin-and-keeping-them-in-that-order/#findComment-1584530 Share on other sites More sharing options...
the_toolman Posted February 16, 2021 Author Share Posted February 16, 2021 Thanks for the reply. I have also seen that I can reorder them by going to Structure > and then click reorder and it seems to have save the order. Quote Link to comment https://forums.phpfreaks.com/topic/312160-reordering-columns-in-phpmyadmin-and-keeping-them-in-that-order/#findComment-1584535 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.