Using the List box with MySQL

5 posts by 3 authors in: Forums > CMS Builder
Last Post: May 15, 2009   (RSS)

By Davidpanter - May 10, 2009

I have created a table called ‘client’ and within that table I have 2 fields’ called ‘client_name’ and ‘branch’.
I have then created another table called ‘fullinfo’ I have created a list box based on the field ‘client_name’ and I have created another list box based on ‘branch’

how do I get the branch box to query the database and only display the braches listed with the same client name (from field client name) ?

should be an easy one I would say but I must be looking at this all the wrong way

If anyone has any ideas

Cheers

Re: [kevindrinkall] Using the List box with MySQL

By Damon - May 12, 2009

Hi Kevin,

I think I'm going to need some more details on this one.

>how do I get the branch box to query the database and only display the braches listed with the same client name (from field client name) ?

Are talking about when you are entering records in the Fullinfo section?

Also, are you wanting to choose an clients name, from the dropdown list, and then have the Branch dropdown dynamically update to show only branch with that client?

Can give some examples? Even with made up data would hopefully help make it more clear how this should work.

Sorry, I'm just having trouble getting my head wrapped around what you are after.
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Using the List box with MySQL

By Davidpanter - May 13, 2009

[font "Calibri"]Ok maybe I need another type of example there are a few areas in which I need to do this so maybe giving another example maybe easier.

Ok I have a table called: equipment type this has the fields: make, model and type

[img]http://www.vixsoft.com/helpmeplease/equipment-type.jpg[/img]

make is the manufacture e.g. ZyXEL, Cisco or HP etc. Model is the actual model number and type is what the item is e.g. Router, Firewall, Server etc.

ok so let’s say I add:
make = cisco
model = 877
type = router


[font "Calibri"][img]http://www.vixsoft.com/helpmeplease/equipmenttypeoptions.jpg[/img]



next section:

I have a table called clients_equipment I have added 3 list box’s based on the fields from the table above (equipment_type)

what I want to be able to do is select type and then make and for the list for make to dynamically update to only display items that have router in the type and then for the model list box to update to only show the items that have both the make and type matching


[font "Calibri"]e.g. I select Router from the type list box and the list box will then display ZyXEL and Cisco (as they have been set with Router in the field: type in the table equipment_type) I select Cisco from the make list box (as this has been set in the make field within the table equipment_type) and then the model should only display 877

Type > Make > Model
Router > Cisco > 877

Type > Make > Model
Firewall > ZyXEL > USG100, USG200, USG300



[img]http://www.vixsoft.com/helpmeplease/clientsequipment.jpg[/img]


Hope this is clearer than before. somtimes its very difficult to discribe what you are trying to achive.

Many thanks kevin

Re: [kevindrinkall] Using the List box with MySQL

By ross - May 15, 2009

Hi Kevin

Thanks for those screens! I think I see what you are doing here. Basically, it's going to be really difficult to get those drop down values changing in the admin interface.

What we could do though is setup a custom script for you that is basically the exact same thing (a form that lets you add records to the database) but because it isn't in the main admin interface, we have the code to handle those drop downs.

Because it would be a custom job, we'll need to go through consulting@interactivetools.com. Drop me and email and we'll go over it in more detail.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/