The PHP/MySQL dynamic drop-down list

I know this should be easier he became... I even bought two new books on PHP and Dreamweaver, and I'm still lost.

I am trying to create a very simple search for a Web site. This research would be a category based with a drop-down list only search. There would also be an admin section that would add new records to the DB.

So far, I have created a basic admin page that submits new records to the appropriate categories.

I created a simple search with a dynamic Drop Down page, and I have created a basic results page.

If the problem I have is that the Drop Down dynamic list shows the names of similar category according to the number of records exists. Where it should show only the unique category names.

Once selected, the results page and the records are displayed correctly using a dynamic array.

Anyone know what I should do to change this dynamic list so that it does not display the duplicate names?

Thank you.

destind4film wrote:
> Can give you details on how to do it. I saw this same response in another
> post in the forums but I do not understand where this setting is.

This is a very basic SQL query. The SEPARATE after that SELECT keyword ensures
that duplicate records are removed from the Recordset.

> I checked my phpmyadmin and there is an option for single, but it will not
> work for categories in my PB because there are naturally several entries
> with the same name of category attached.

UNIQUE is a type of index that forces a column to store only unique values.

> I don't see this option in DW.

You will not. Dreamweaver provides the absolute basics to create the
code for working with a database. Unless you want to be severely limited in
what you create, you have to learn a few basics of database
design and build your own SQL queries.

To add SEPARATE to your basic SQL query, you must click on the Advanced
button in the Recordset dialog box and insert it into the SQL query by hand.

--
Adobe Community Expert David Powers
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

Tags: Dreamweaver

Similar Questions

  • Dynamic drop-down list in the Bay of cluster

    I have a table of cluster that contains two drop-down list boxes. The first drop-down list box control which Articles of the second drop-down list box by writing in the node property [StringsAndValues] for the second box. The problem I have is when I create a new index in the table of cluster and select different values in the drop-down list boxes, it changes the area of dynamic drop-down list on all indexes in the table. Attached, that's what I have so far.

    Thank you

    Chris

    Wow, what are the chances of another thread like this so early.

    Check out this other thread and look at the link of Hooovahh to see a great way to change the drop-down list box strings during execution to give the appearance different drop-down list boxes. The reality is that you can't have the combo box different types/lists in the same table. So what it is, is to check what element you are clicked on and change the behavior of the combobox as a result.

  • Populate drop-down list with the results of several drop-down lists

    Hi, I am creating a form where the results of two drop-down lists then would fill another drop-down list. I'm not new to javascript, but I'm new to using it in Acrobat, so while I found some answers to this: Drop-down list fill in multiple fields of text. I don't know where to implement this, if it is still the right thing, I'm looking for pipes for

    Oh and I use Acrobat Pro DC. Any help would be much appreciated!

    OK, you can create a function at the level of the document that is called in the Validate event of each of the two first drop down menus, something like:

    Function in JavaScript to the document level

    function updateDropdown() {}

    Get references to the drop-down menus of entry

    var F1 = getField ("DropdownList1");

    var F2 = getField ("DropdownList2");

    Refer to the output drop-down list

    F3 var = getField ("DropdownList3");

    Get the values of input field, as strings

    var s1 = event.target = f1? Event.value: f1.valueAsString;

    var s2 = event.target = f2? Event.value: f2.valueAsString;

    Fill the drop-down list of output with the elements, or deselect it if either input dropdown is 'empty' (single topic area)

    If (s1 = "" |) s2 === " ") {

    F3.clearItems ();

    } else {}

    F3.setItems (["", s1, s2]);

    }

    }

    In the two first downs Validate event, call this function like this:

    updateDropdown();

    You can of course name the function you want. More information about the properties and the methods used in the code are available in the Acrobat JavaScript documentation.

  • If statement to change the items in a drop-down list

    Is there a way to change the options in a drop-down list in a script (without data binding)? So I have a drop down list and depending on what the user selects the second drop-down list will have different options. These elements can be specified by an if statement in the preOpen the second dropdown list event? The form will be filled out offline, so I don't want to put a link of data binding.

    Thank you!

    Hello

    There are at least two ways, as shown in http://forums.adobe.com/message/4321707#4321707.  Basically clearItems/addItem if pre Reader 9.0 or setItems supported if you use Reader 9.0 or later.

    Bruce

  • Download the news of a drop-down list for a field of text box

    Its that simple! That's all I need to know! The code to add to the information in a drop-down list (_cb) to a text field. I need to know wear put on the script IE in the action on the _cb layer. Your all!

    on the timeline that contains your combobox with instance name _cb that you can use:

  • dynamically load the Options in a drop-down list in C++

    Hey guys,.

    I'm trying to dynamically load items Option in a drop-down list by using C++.  I have a function in my class of WorkManager file that does the trick:

    QStringList WorkManager::getListOfItems() {
        int i = 0;
        QStringList taskNames;  // used for debugging mainly, so i can print the list out to debug
        QList  myObjects = m_model->toListOfObjects();
        DropDown * dpList = bb::cascades::Application::instance()->scene()->findChild("scriptListDropDown");
        if (dpList != 0 ) {
            dpList->setSelectedOption(0);
            dpList->removeAll();
            for (i = 0; i < myObjects.size(); i++) {
                Task * myTask = (Task *) myObjects[i];
                taskNames.append(myTask->taskName());
                dpList->add(Option::create().text(myTask->taskName()).value(myTask->command()));
    //          delete myTask;  // do I need to delete the task object?
            }
    //      qDebug() << "WorkManager::getLIstOfItems(), ---> list of tasks is : " << taskNames;
            return taskNames;
        } else  {
            qDebug() << "WorkManager::getListOfItems(), ---> dpList was 0";
            return taskNames;  // empty list
        }
    }
    

    I also found this thread:http://supportforums.blackberry.com/t5/Native-Development/Adding-options-to-a-DropDown-from-c/m-p/21... that helped me get the filled drop-down list when the application starts.

    However, I need to re - fill list from time to time, when the list (a GroupDataModel) changes.  calling the function above a second time anywhere in my application appears to hang the application immediately.

    I think / thought it might have something to do with the slot for the onSelectedValueChanged, but I can't understand it.

    It seems down right when I do dpList-> removeAll().

    I also can't seem to find the right place to call this function to an object of type in my class.  I think it's because the drop-down list is not ready yet as the dpList * is always 0 unless what I call after the line:

    app->setScene(root);
    

    in the applicationui.cpp file.  Calling it works on start-up, but trying to update the list later (by removeAll() and recreate) causes the app crashing.

    is there a better way to do it?  .. and make it safer?  I can't understand how to do this.

    Thank you!

    J

    First, drop the:

    dpList->setSelectedOption(0);
    

    Not only if it is not necessary, but it will explode your application if the function is called when there is already no options in the menu dropdown.

    Also, do NOT delete the task, because it is still owned by the datamodel. I also see that you use type casting C, which just blindly accepts your cast, even if it's a mistake. Instead, if you know for sure what kind it will be this way instead:

    Task* myTask = static_cast(myObjects[i]);
    

    If you are not sure if the type you are casting the is the type you need, use the dynamic_cast instead:

    Task* myTask = dynamic_cast(myObjects[i]);
    

    The advantage of this more static_cast , is that if you try to perform a type cast is not compatible, then myTask will be set to NULL.

    Alternatively, Qt offers a replacement for dynamic_cast which works on platforms where is not regular C++ casts.

    Task* myTask = qobject_cast(myObjects[i]);
    

    It is functionally equivalent to dynamic_cast, but as I said, it works on all platforms that Qt exists, whereas dynamic_cast cannot.

    Once you did get back to us.

    oddboy wrote:

    Hey guys,.

    I'm trying to dynamically load items Option in a drop-down list by using C++.  I have a function in my class of WorkManager file that does the trick:

    QStringList WorkManager::getListOfItems() {
        int i = 0;
        QStringList taskNames;  // used for debugging mainly, so i can print the list out to debug
        QList  myObjects = m_model->toListOfObjects();
        DropDown * dpList = bb::cascades::Application::instance()->scene()->findChild("scriptListDropDown");
        if (dpList != 0 ) {
            dpList->setSelectedOption(0);
            dpList->removeAll();
            for (i = 0; i < myObjects.size(); i++) {
                Task * myTask = (Task *) myObjects[i];
                taskNames.append(myTask->taskName());
                dpList->add(Option::create().text(myTask->taskName()).value(myTask->command()));
    //          delete myTask;  // do I need to delete the task object?
            }
    //      qDebug() << "WorkManager::getLIstOfItems(), ---> list of tasks is : " << taskNames;
            return taskNames;
        } else  {
            qDebug() << "WorkManager::getListOfItems(), ---> dpList was 0";
            return taskNames;  // empty list
        }
    }
    

    I also found this thread:http://supportforums.blackberry.com/t5/Native-Development/Adding-options-to-a-DropDown-from-c/m-p/21... that helped me get the filled drop-down list when the application starts.

    However, I need to re - fill list from time to time, when the list (a GroupDataModel) changes.  calling the function above a second time anywhere in my application appears to hang the application immediately.

    I think / thought it might have something to do with the slot for the onSelectedValueChanged, but I can't understand it.

    It seems down right when I do dpList-> removeAll().

    I also can't seem to find the right place to call this function to an object of type in my class.  I think it's because the drop-down list is not ready yet as the dpList * is always 0 unless what I call after the line:

    app->setScene(root);
    

    in the applicationui.cpp file.  Calling it works on start-up, but trying to update the list later (by removeAll() and recreate) causes the app crashing.

    is there a better way to do it?  .. and make it safer?  I can't understand how to do this.

    Thank you!

    J

  • initialize a dynamic drop-down list

    I have a table (say table1) with 11 courses, of which 4 are foreign keys.
    When you create a new record, I use drop-down lists to fill 4 foreign key fields in table1.
    When I update the table 1, I use a drop-down list on the search page to select the record and pass it to the edit page via an URL parameter. No foreign keys appear in the new page into a field of text without problem and can be edited. Foreign keys can be displayed without problem, but if I want to change, I have to use a list of to do.

    Each foreign key is contained in a menu drop-down filled from its own set of records.

    Is there a way that these drop-down lists can be dynamically initialized to the foreign key value in Table 1? Or is there a better way to do it?

    Some of the key run in the hundreds, and having set all 4 manually before an update can be made is tedious.

    I work in php5 and Mysql.
    Howard Walker

    It solved!
    I was setting the initial value of the dynamic list of its own key, rather than the foreign key in table1.

    Must be getting old!
    Sorry to trouble you.

  • Problems of dynamic drop-down list box

    Hello

    I have a requirement for a list dynamic downdown.

    I use javascript itself to fill the 2 text fields in the drop-down list.  I need the list/menu area drop down to be able to have options to input from the user and the drop-down list. I selected the "user entered - optional" compared to the setting but does not seem to work.

    The drop has used names and if a new employee joined this company and I do not know the end user can enter the name of the employee in the field.

    I have attached a pdf file version.

    Any ideas or help would be great.

    See you soon.

    Hello. All you have to do is check the box "Enable custom text entry". You can find the object box > cell phone

  • Make a field of text/hide according to the results of a drop-down list box

    Hello

    I wonder if someone could help me with this. I want to show/hide some text boxes in my form according to the choice made by the person filling in. For example, there is a dropdown list containing a selection of numbers 1-4. If 1 was selected, the text boxes below 1 would be visible and obligatory, if the 2 have been chosen, 2 text boxes below would be visible and required etc...

    I'm new to FormCalc (only started using it this morning), so simple a possible explanation would be fantastic.

    Thanks for reading!

    Of course, you can have javascript and formcalc in the form. Not only the two in the same field, same event; D

    Okey, let's try some things:

    (1) check if the "binding" from the drop-down list is the same as the values that you choose. In the script you are referring to the bound values.

    (2) other names for the Textfields would be better, because it is more difficult to refer to "Textfield1 [1]" then to for example: 'New '. I was just to lazy to give them names. (If it's on another page or subform, you refer to the fields correctly: as MyForm.FirstSubform.FirstTextfield... this name lies in the specific script field.)

    (3) check your script once more... want to make invisible mandatory fields?

    (4) check if your form is dynamic. (If it isn't you will not see the changes...)

    You should probably do it in small steps, such as:

    (1) first of all, you refer to areas such as:

    This.rawValue = Firstfield.rawValue;

    If the changed value fields got you its name and to be sure that the event you put is the right one.

    (2) try the different parts of the script and look at how it works. Problems can be more easily found and then

  • Where is the past, bookmark button that displays all THE bookmarks as a drop-down list?

    I had to reinstall my OS, and now I don't see the big 'Favorites' button, I got to the right of the search box Google with Firefox.
    It is with the value 'Icons' of icons.
    I use to be able to click on "Favorites" and they appear in a drop-down list, like 'latest news' power works.
    I can click the Favorites (with the star on this subject), who comes here to open a sidebar - not a menu drop-down which disappears when I clicked it.

    I loaded Windows 7 and took some quick screenshots for you:
    http://tinyurl.com/3c7ouvs

    Also note that it only shows the bookmarks menu button if you use the Firefox menu button and not the classic menu bar, because it would be quite redundant to have a button and the bookmarks at the top menu which does exactly the same thing.

    Look at what you have in the toolbar and what is in the window customize (you may need to scroll down). If you have one in the toolbar then the other is probably in the window customize somewhere. If you have a lot of addons installed there may be many buttons to look through.

    If you have problems you can just click on the 'Restore Default Set' button in the Customize dialog box to restore the default values that will also involve of the bookmarks that you want to switch all your toolbars. If you had any other customizations to your toolbars and then change them back again.

  • drop-down lists on the forms don't drop-down list

    I use Firefox 3.6.16 on Mandriva 2010.2 and for the last two months, the drop-down lists don't dropdown. I thought a patch would come out to fix it or it would be one of my modules cause. There was an update recently and it has not fixed. Today, I've disabled all addons and restarted, but still it does not allow me to make a choice with the mouse.

    There are many similar problems with FF4, but none of the solutions appear to be relevant.

    Anyone got any suggestions?

    < edit > I just disabled all the plugins too but still the same. What I noticed at the time, is that there seem to be two versions of Flash installed, but only the first shows under tools modules Plugins

    There is no need to create a new thread. You can edit your first post and change the title, if you want to change it or I can do it if you post a better title.

    Problems with a menu drop-down does not not can be caused by an extension.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions of the origin of the problem (switch to the DEFAULT theme: Tools > Modules > appearance/themes).

    See:

    If this does not work in mode without failure, then disable all extensions and then try to find out who is the cause by allowing both the problem reappears.

    • Choose "Disable all add-ons" on issues to troubleshoot Firefox in Safe Mode to set window to disable all extensions.
    • Close and restart Firefox after each change through "file > exit ' (Mac: ' Firefox > leave";) Linux: "file > exit ')
  • How to change the items in a drop-down list box that is part of an array of clusters

    Hello

    In the attached vi, I have an array of clusters and each cluster contains two drop-down list boxes. How can I edit the items in the drop-down list box 1 for all elements in the array? (All elements of list box 1 has the same elements.)

    By way of illustration, I have also included the case of trivila, for example, edit the items in a separate drop-down list box that is is not part of an array of clusters (combo box 3). Please notify. Thank you.

    Peter

    Right click on the drop-down list box and select Create-> Node-> String() property. Place it on the block diagram. Change to write (right click) and then feed him an array of strings.

  • Modification of the properties-type def drop-down list box

    I have a group of 32 cases of a def type. The def type contains several different types of control. What I have to do is to change the properties of the list box for each of the type defs. Normally, I would create an array of references to change the properties for each of the type defs, but when I try this I can not access the properties of string [] for combo box selections. The only way I found to fix it is to create a reference for each individual drop-down list box item. It is labour, since I'll have 32 elements. Is there a way to beeter to do this? The first screenshot shows the issui I'll have, not being able to change the properties of specific elements within each of the def type at runtime through a control [] array. The second screenshot shows the only solution I've found so far, which is not very practical.

    You will need to set up (for a more specific class) control to a type of combo box for the particular control [] index that has the combobox control if you want to access the drop-down list.

    You can also access the combobox in a cluster based directly, rigth click on the control reference and a link to the element cluster directly.

    The last option is to make the strictt of typdef will fill all instances with the channel list [] given that it is a strict property.

    the approach is based on the weather, you plan on changing the list during execution.

  • Customize the Format of text, drop-down lists

    Hey all,.

    I have problems of customization of the top botton label of a water drop down. I can customize cell converters labels, but the top label is not affected and is always Times New Roman... Any ideas what I'm missing here?

    Here is a screenshot:

    Here's my CellRenderer customized for the drop down:

    public class CustomDropDownCellRenderer extends DropDownCellRenderer
        {
            public function CustomDropDownCellRenderer()
            {
                super();
            }
    
            override protected function init():void{
    
                var format:TextFormat=new TextFormat();
                format.font="font_helveticaNeue";
                format.size=16;
                format.color=0x000000;
    
                super.init();
    
                setTextFormatForState(format, SkinStates.DISABLED);
                setTextFormatForState(format, SkinStates.UP);
                setTextFormatForState(format, SkinStates.DOWN);
                setTextFormatForState(format, SkinStates.SELECTED);
                setTextFormatForState(format, SkinStates.DISABLED_SELECTED);
                this.label.label_txt.embedFonts=true;
            }
        }
    

    Here's where I put the drop down skin:

    brushDropDown=new DropDown();           brushDropDown.setListSkin(CustomDropDownCellRenderer);
    brushDropDown.setButtonSkin(CustomDropDownButtonSkin);          brushDropDown.addEventListener(Event.SELECT, brushDropDownEventHandler);
    brushDropDown.dataProvider=brushShapes;
    

    I thought I might have to customize the DropDownButtonSkin, but this class does not have a label...

    Any help would be appreciated.

    Hey,.

    I've done some research more and similarly to another thread involving the selector, the own only cut the way to do it is by creating a class sup from the drop-down list. However, this one is kind of weird. Once again, with assistance from flash builder, I could see the protected class drop-down list properties and the objective here is the purpose of __button. now the weird part is that its type is a DropDownButton. they took that as an accessible API since the new update. but I managed to make some changes anyway.

    so the solution, create a void called CustomDropDown class that extends the class from the drop-down list. After that, in the constuctor, use the this.__button.getTextFormatForState () method to manipulate the textformat of the button. Here is an example:

    ListTests.as:

    package{   import flash.display.Sprite;  import flash.display.StageAlign;  import flash.display.StageScaleMode;
    
      import qnx.ui.data.DataProvider;  import qnx.ui.listClasses.DropDown;   import qnx.ui.listClasses.List;
    
      [SWF(width="1024",height="600",backgroundColor="#E8E8E8",frameRate="30")] public class ListTests extends Sprite {     private var myList:CustomDropDown;       private var myDataProvider:DataProvider;      private var myArray:Array;
    
          public function ListTests()       {         super();
    
              // support autoOrients            stage.align = StageAlign.TOP_LEFT;            stage.scaleMode = StageScaleMode.NO_SCALE;
    
              myList = new CustomDropDown();           myArray = new Array();
    
              myArray.push({label: "Thomas Luddington"});           myArray.push({label: "Master Maruyn"});           myArray.push({label: "Master Gardyner"});         myArray.push({label: "Captain Vaughan"});         myArray.push({label: "Master Kendall"});          myArray.push({label: "Master Prideox"});          myArray.push({label: "Robert Holecroft"});            myArray.push({label: "Rise Courtenay"});          myArray.push({label: "Master Hugh Rogers"});          myArray.push({label: "Thomas Foxe"});         myArray.push({label: "Edward Nugen"});            myArray.push({label: "Darby Glande"});            myArray.push({label: "Edward Kelle"});            myArray.push({label: "Iohn Gostigo"});            myArray.push({label: "Erasmus Clefs"});           myArray.push({label: "Edward Ketcheman"});            myArray.push({label: "Iohn Linsey"});         myArray.push({label: "Thomas Rottenbury"});           myArray.push({label: "Roger Deane"});         myArray.push({label: "Iohn Harris"});
    
              myDataProvider = new DataProvider(myArray);
    
              myList.dataProvider = myDataProvider;
    
              myList.setPosition(10,10);            myList.width = 300;
    
              addChild(myList);
    
          } }}
    

    CustomDropDown.as:

    package{   import qnx.ui.listClasses.DropDown;   import qnx.ui.skins.SkinStates;
    
      public class CustomDropDown extends DropDown {     public function CustomDropDown()      {         super();
    
              this.__button.getTextFormatForState(SkinStates.UP).font = "Comic Sans MS";            this.__button.getTextFormatForState(SkinStates.SELECTED).font = "Comic Sans MS";          this.__button.getTextFormatForState(SkinStates.DOWN).font = "Comic Sans MS";          this.__button.getTextFormatForState(SkinStates.DOWN_SELECTED).font = "Comic Sans MS";                  } }}
    

    And Yes, clearly I'm a fan of Comic-who isn't?

    Yet once, it is going to work identical to the drop-down list but instead allows you to set your own font. in fact, you can create a new method which is what I did in the above code, so you can change the font on the fly without having to make five different subclasses just to change the textformat! hope that helps. Good luck!

  • Change the background color of a table cell, depending on the selection in a drop-down list

    I have a drop-down list wrapped in a subform in a table cell. Users can choose green, yellow or red, and I want the background color to change according to their choice.

    Can you tell me why this script does not work? I'm sure that some of you, dear friends can see in a second.


    If (this. ListItem == "green") {}

    Subform1.DropDownList1.fillColor = "000,128,000"; BackgroundFill = "solid";

    }

    If (this. ListItem == 'yellow') {}

    Subform1.DropDownList1.fillColor = "255,128,000";

    }

    If (this. ListItem == 'red') {}

    Subform1.DropDownList1.fillColor = "255,000,000;

    }


    Thank you

    Hello

    I think you should be able to use the following code in the event change of the dropdownlist control.

    Form1. #subform [0]. Table1.row2.DropDownList1::change - (JavaScript, client)

    If {(xfa.event.change=="green)"}

    this.fillColor = "000,128,000";

    }

    If {(xfa.event.change=="yellow)"}

    this.fillColor = "255,128,000";

    }

    If {(xfa.event.change=="red)"}

    this.fillColor = "255,000,000;

    }

    Concerning

    Bruce

Maybe you are looking for