dynamic query

Reply

Join Date: Dec 2007
Posts: 5
Reputation: sanch3za is an unknown quantity at this point 
Solved Threads: 0
sanch3za sanch3za is offline Offline
Newbie Poster

dynamic query

 
0
  #1
May 13th, 2008
for example :
I have 4 check box with their own variables a,b,c,d
How can I create query with condition using what users choose,
where users can choose more than one check box

thanks for your support
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: dynamic query

 
0
  #2
May 13th, 2008
What type of query (SELECT, UPDATE, INSERT...). Also, can you provide the html for the checkboxes?
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 2
Reputation: RupertA is an unknown quantity at this point 
Solved Threads: 0
RupertA RupertA is offline Offline
Newbie Poster

Re: dynamic query

 
0
  #3
May 13th, 2008
maybe something like:
"select.....blah blah....where a = $_POST['checkboxarrayname']['a'] and b = $_POST['checkboxarrayname']['b']"
and the html is:
<input type='checkbox' name='checkboxarrayname[a]' value='1'>

basically using posting array variables
HTH
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 5
Reputation: sanch3za is an unknown quantity at this point 
Solved Threads: 0
sanch3za sanch3za is offline Offline
Newbie Poster

Re: dynamic query

 
0
  #4
May 16th, 2008
the problem is we don't know which checkbox is checked and count how many checkbox is checked, example we know 2 checkbox is checked so the query is two condition. if three checkbox is checked so the query is three condition.
can I make a query with a dinamic condition according how many checkbox is checked?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,739
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 330
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: dynamic query

 
0
  #5
May 16th, 2008
When you submit the page, only those checkboxes which were checked will be submitted. So, you will have the count of checkboxes which are checked, you will have all the checkboxes which were checked. Build your query depending upon those values.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
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