Web Analytics Made Easy -
StatCounter SOS; Create Select Menu - CodingForum

Announcement

Collapse
No announcement yet.

SOS; Create Select Menu

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SOS; Create Select Menu

    Hi..
    I am new to php and I am trying to create a Select menu, the values in which are the names of the columns. Could anyone help me with this? I have connected to the data base and have also created another menu where DISTINCT data of one specified column constitute the values of the menu.

    What is the sql command to retrieve all column names of a table except the primary key column?

    This is urgent.Thanks
    Salim

  • #2
    Hi, I'm not sure I'm understanding exactly what you're trying to do, perhaps you could give an example of the data and columns and what effect you're trying to achieve...
    eg:
    I have columns field1, field2 and field3... and I want a script to make this:
    Code:
    <select>
         <option>field1</option>
         <option>field2</option>
         <option>field3</option>
    </select>
    then someone might respond with something like
    PHP Code:
    $strSQL "SELECT * FROM table";
    $sql mysql_query($strSQL) or die(mysql_error());
    $row mysql_fetch_array($sql)

    echo 
    "<select>";
    foreach(
    $row as $key => $val){
       echo 
    "<option>$key</option>";
    }
    echo 
    "</select>"
    now I dont think this is what you're trying to do but it might give you a clue as how to do what you're trying to do or at least give you an example of how you can present your question so that we understand what you're trying to achieve and hopefully someone can help you
    http://www.hazelryan.co.uk

    Comment

    Working...
    X