Unable to preform queries within one button

Reply

Join Date: Dec 2007
Posts: 608
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 8
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Unable to preform queries within one button

 
0
  #1
Oct 8th, 2008
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/post64...tml#post646916
Last edited by OmniX; Oct 8th, 2008 at 10:23 pm.
"You never stop learning." - OmniX
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 150
Reputation: sDJh is an unknown quantity at this point 
Solved Threads: 13
sDJh sDJh is offline Offline
Junior Poster

Re: Unable to preform queries within one button

 
0
  #2
Oct 9th, 2008
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:
  1. funciton buttonA(){
  2. //perform stuff for button A
  3. }
  4. funciton buttonB(){
  5. //perform stuff for button B
  6. }

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.
  1. if($buttonA=="checked")buttonA();
  2. if($buttonB=="checked")buttonB();
  3. if($buttonAB=="checked"){buttonA();buttonB();}
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC