Results 1 to 5 of 5

Thread: using phpmyadmin to order cols

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,045
    Thanks
    95
    Thanked 98 Times in 96 Posts

    Default using phpmyadmin to order cols

    Hi,

    Is there a way to use phpmyadmin to order columns? Most of my tables do not have too many columns, but I have one or two with 30+ cols and I want phpmyadmin to list them alphabetically as opposed to the order in which they were stored/created. Is there a way to do this via phpmyadmin or with a query?

    Thanks
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    To view them? Click the column title, I believe.

    To search through them this way, use 'ORDER BY colname' in the query.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,045
    Thanks
    95
    Thanked 98 Times in 96 Posts

    Default

    Actually, what I meant to say was, how do you sort the fields in phpmyadmin. For example, when viewing a given table structure there will be a column for the names of the fields. What I want to be able to do is order the field names of the table alphabetically. Permanently, if possible.
    To choose the lesser of two evils is still to choose evil. My personal site

  4. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,045
    Thanks
    95
    Thanked 98 Times in 96 Posts

    Default

    It seems that you can do this with the following:

    Code:
    $query="ALTER TABLE t1 MODIFY column1 text AFTER column2";
    $exec=mysql_query($query,$connection);
    I have not tried it out just yet, but will soon.

    I got the idea from this reference: http://forums.digitalpoint.com/showthread.php?t=825045
    Last edited by james438; 08-23-2010 at 02:24 AM. Reason: added reference
    To choose the lesser of two evils is still to choose evil. My personal site

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Oh I see. Your question can be read two ways but now that you explained a bit more it seems obvious. Glad you found that. Never ran into this situation before. Interesting. I don't think phpmyadmin really has any tools for that though.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •