| | |
Unable to preform queries within one button
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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
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
•
•
Join Date: Aug 2005
Posts: 150
Reputation:
Solved Threads: 13
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:
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.
First of all I'd work with functions. Try something like:
PHP Syntax (Toggle Plain Text)
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.
PHP Syntax (Toggle Plain Text)
if($buttonA=="checked")buttonA(); if($buttonB=="checked")buttonB(); if($buttonAB=="checked"){buttonA();buttonB();}
![]() |
Other Threads in the PHP Forum
- Previous Thread: login error
- Next Thread: PHP reminder E-mail - Cron job to run the script
| Thread Tools | Search this Thread |
301 apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html httppost if...loop image include insert ip javascript joomla jquery key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search searchbox server session sessions sms sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website youtube zend





