Hi

I posted something about this awhile back and the problem was, I was preforming several queries at once along with some other mysql functions and it always stopped working half way (I think was to do with the interaction of my functions with the header or my use of multiple queries within a loop).

The only solution I personally came up with was to cut the code in half and let buttonA do jobA and buttonB do jobB.

I dont want to bore people with just copy and paste 2/300 lines of code so I will break it down into simple point notation which may reveal the problem (hopefully :():
BUTTON A
- header(refresh)
- variable intialization
- for loop
-- update query
- break

BUTTON B
- header(refresh)
- variable intialization
- update query
- while(mysql_fetch_asoc)
-- condition statements
-- for loop
--- update query
- break

Goal: BUTTON AB does everything stated above.

Thankyou in advance, Regards X

PS: the previous thread http://www.daniweb.com/forums/post646916.html#post646916

So do you have 3 buttons "A", "B" and "AB" or do you have a form with checkboxes so that the user can choose which options he(she want's to perform?

First of all I'd work with functions. Try something like:

funciton buttonA(){
//perform stuff for button A
}
funciton buttonB(){
//perform stuff for button B
}

This makes it much easier in later days to change little things in your code (bugs, updates etc).

Then you basically check which button is clicked/checked and depending on it you execute your written function.

if($buttonA=="checked")buttonA();
if($buttonB=="checked")buttonB();
if($buttonAB=="checked"){buttonA();buttonB();}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.