Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating a <select> with table names

    Hi, I was wondering if there is anyway to get all the tables in a mySQL database and insert it into a Drop down box with php, or any other language.

  • #2
    Regular Coder BonRouge's Avatar
    Join Date
    Mar 2006
    Location
    Sendai, Japan
    Posts
    328
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    $tables=mysql_list_tables($dbname);
      echo 
    "<select>";
      
    $table 0;
      while (
    $table mysql_num_rows($tables)) {
        
    $tablename=mysql_tablename($tables$table);
        echo 
    "<option><value=\"$tablename\">$tablename</option>\n\r";
        
    $table++;
      }
      echo 
    "</select>"

  • #3
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much BonRouge


  •  

    Posting Permissions

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