SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP function to Obtain the fields of a specific MySQL table

    Hi all, is there a PHP based function that can retrieve exactly what fields are contained in a specfic MySQL table?

    Thanks

    Tryst

  2. #2
    SitePoint Zealot ssttoo's Avatar
    Join Date
    Jan 2004
    Location
    LA, California
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use a MySQL query:
    Code:
    SHOW COLUMNS FROM the_name_of_your_table;
    there is a php function mysql_list_fields() but they say it's not working 100% properly.

    The same is true for mysql_list_tables(), you can do it with:
    Code:
    SHOW TABLES;
    or
    Code:
    SHOW TABLES FROM your_database_name;

  3. #3
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep, just found it on the PHP manual

    Thanks

    Tryst


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
  •