Results 1 to 3 of 3

Thread: PHP Combo Box

  1. #1
    Join Date
    Oct 2003

    Question Unanswered: PHP Combo Box


    I'm trying to convert something I originally done in ASPX with MS Access, into a PHP and MySQL web page but I'm having a little difficulty with a combo box.

    What I want to do is retrieve a list of table names and place them into a combo box. This works fine in Access using the following;

    SELECT MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Name)<>'MSysObjects') AND ((MSysObjects.Flags)<>-2147483648 And (MSysObjects.Flags)<>2 And (MSysObjects.Flags)<>-2147483645) AND ((MSysObjects.Type) In (1,4))) ORDER BY MSysObjects.Name;

    After converting this code into my PHP strings my combo boxes are coming out blank. Could someone please take a look and tell me if either something is wrong with my code, or if the SQL string above doesn't work in MySQL. In either case an option to rectify this would really help. Note that the connection strings are correct, it's only from $result and below that I'm not sure about

    <select name="TranslateFrom" id="TranslateFrom">
    mysql_select_db ("MyDatabase", $con);
    $result = mysql_query("SELECT MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Name)<>'MSysObjects') AND ((MSysObjects.Flags)<>-2147483648 And (MSysObjects.Flags)<>2 And (MSysObjects.Flags)<>-2147483645) AND ((MSysObjects.Type) In (1,4))) ORDER BY MSysObjects.Name");

    while($row = mysql_fetch_array($result))

    echo "<option value =" . $row['Name'] . "> " . $row['Name'] . " </option>";


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    have you checked that the SQL returns anything
    hace you checked the MYSQL_ERRNO and/or MYSQL_ERROR functions

    my suspiscion is that you are trying to access the system objects in a MySQL database using syntax / column or table names from an Access/JET database. the system objects in a MySQL db is in a databse called 'information_schema'. I'd suggest you get a copy of a suitable SQL query tool such as MySQL Query browser. there are other tools such as Heidi SQL
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2009


    First, please call the element what it is. It is a called a select element.
    <select name="pickme">
    <option value="A">A</option>
    <option value="B">B</option>
    <option value="C">C</option>

    On the server side, you look for the name and value pair. It also depends on whether this is a POST or GET operation. GET, the name value pairs are visible in a URL, POST the name value pairs are sent directly to the server.


Posting Permissions

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