close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic Dropdowns inserting ID value instead of text value

Thread began 7/18/2014 11:09 am by iainmacdonald331081 | Last modified 7/18/2014 12:07 pm by iainmacdonald331081 | 937 views | 2 replies |

iainmacdonald331081

Dynamic Dropdowns inserting ID value instead of text value

I almost got this working very quickly. The drop downs themselves work on the page correctly, but I have gotten the fields wrong somewhere. Looking through the tutorial I think I've followed it correctly, but must have gone wrong somewhere.

The tables are:

Parent - categoriesFull

CategoryID (PK)
Category

eg 12, Best Safari Cuisine

Child - categoriesShort

CategoryShortID (PK)
CategoryShort
CategoryFullID

eg 12, cuisine, 12

And I have this as my insert:

$ins_nominations->addColumn("Category", "STRING_TYPE", "POST", "Parent");
$ins_nominations->addColumn("Category_Short", "STRING_TYPE", "POST", "Child");

Which is inserting the 12, 12 instead of Best Safari Cuisine, cuisine.

Have attached a copy of the file.

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, the select list will pass the ID as the value when inserted, that is the desired behavior. it should insert the ID value, that is the proper use a relational database.

the category name is defined in the category tabel you relate the category to an item by using the category ID in the item table.

the point of a relational database is data normalization. it takes less storage to store an ID in the item table to to store a string. you don't want to repeat the category name over and over again, that would be a waste ofd space.

store the ID in the items table which is more efficiant, and use a join query to return the related information from the items and category table when you need to display it.

Sign in to reply to this post

iainmacdonald331081

I'm with you - up until now I had the categories in my nomination table, but now that I have a new table for categories, I don't need them in there. Just, as you say, the CategoryID.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...