Page 1 of 1

Drop Down Menu

Posted: Sat Apr 20, 2002 9:11 am
by abionifade
Hi,

i have created a drop down menu script which at the moment displays the results of just one coloumn within one of my database tables. How can i modify the script to display more than 1 coloumn, i.e. 4?

The code currently looks like this

Code: Select all

$query = mysql_query("select * module_1 from module_table WHERE user_id='$myvar' "); 
  
  
    while($rows = @mysql_fetch_array($query)) {
    echo "<option value="$rows&#1111;module_1]">$rows&#1111;module_1]</option>
I'd like to display column names module_1, module_2.....module_4

I would obviously include the required modules in my SELECT statement, but im unsure as to how to reshape my existing code in the dropdown section.

Code: Select all

echo "<option value="$rows&#1111;module_1]">$rows&#1111;module_1]</option>
I understand that it is good practice to create a separate table for such issues within my database, but this example is a special circumstance in which i have to preserve this structure. :?

Another quick question associated with this as well, assuming that i have 'two' drop down menus, both passing variables of 'different' values. i.e. one is echoing the column name MODULE_TITLE and the other dropdown echoing the coloumn names MODULE_1, MODULE_2, ....MODULE_4. In my INSERT statment, is there any sytax that i can use to INSERT any of the above variables into 'ONE' coloumn name? for example in pesudo code - insert into module_title VALUES module_title OR MODULE_1 or MODULE_2....MODULE_4

Your suggestions and questions are welcome and appreciated

Thank you

-Abi :o

Posted: Sat Apr 20, 2002 10:47 am
by fatal
To make you script grab more querys, just take out the user_id varaible. Or also if you have 10 coloumns, and you only want to display 5 - 9 put: 5 <= $user_id <= 9