954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

dynamic query

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

sanch3za
Newbie Poster
5 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

What type of query (SELECT, UPDATE, INSERT...). Also, can you provide the html for the checkboxes?

buddylee17
Practically a Master Poster
697 posts since Nov 2007
Reputation Points: 232
Solved Threads: 137
 

maybe something like:
"select.....blah blah....where a = $_POST['checkboxarrayname']['a'] and b = $_POST['checkboxarrayname']['b']"
and the html is:

basically using posting array variables
HTH

RupertA
Newbie Poster
2 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

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?

sanch3za
Newbie Poster
5 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

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.

nav33n
Purple hazed!
Moderator
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You