Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check box update in database

Status
Not open for further replies.

olegflute

Technical User
Sep 10, 2003
11
AU
Can somebody help me with the code. I retrieve dynamically records (shop items) from the database and the check boxes next to each item. The values of the check boxes are retrieved dynamically as well (yes/ no, depends if products exists). Then I select or deselect the check boxes (items) that I want and click the update button. The next page update the check boxes fields in the database. I suppose I have to use item ID in check box’s VALUE field and some loop through check boxes collection, right?
 
Use the id as value and same name for checkboxes
and then on the server you can update fields right they are.

fields=Request("myCheckBoxName")
"UPDATE myTable set myField=false" - first querry and then
"UPDATE myTable set myField=true where myID in ("& fields &")"

This should do it, since the fields it's an comma separated string.
fields could be something like this
1,10,14 or just 1 or 1,23,45,67,100... etc
the IN operator expects just the same format for the enumeration.

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top